我在R中使用d3heatmap包来绘制热图.当我在Rstudio中使用它时,我可以通过从查看器菜单中选择保存图像来保存它生成的图像.我想知道如何将热图保存到Rscript中的文件.显然,png(filename)不起作用.
我想在Ocaml中编写一个函数,给出一个四元组列表和一个四元组(x,y,z,f),返回一个包含元组(x',y',z',g)的列表,这样x = x'或y = y'或z = z'(这些是整数).这是我的第一次尝试
let rec constrained_by c list =
match s with
| []-> []
| hd :: tl ->
begin
let Cell(x,y,r,_)= c in (*warning*)
begin
match hd with
| Cell(x,_,_,Some(_))-> hd::constrained_by c tl
| Cell(_, y, _,Some(_)) -> hd::constrained_by c tl
| Cell(_, _, r,Some(_)) -> hd::constrained_by c tl
| _ -> constrained_by c tl
end
end
Run Code Online (Sandbox Code Playgroud)
问题:当它被调用时,无论我们匹配什么四倍,它都会返回原始列表.此外,问题是返回警告,行,(警告)的x,y,r 未使用.
在下面的JavaScript代码段中,我希望console输出只有3Chrome和Mozilla,它是23.为什么?
var status = ["Busy", "Preferred", "Available"];
console.log( status.length);
Run Code Online (Sandbox Code Playgroud) 我使用以下代码来计算MD5哈希码的二进制表示.
MD5 始终为 128个字节,并bin返回以"0b"开头的字符串.因此,长度md5_bin必须始终为130,但是当我运行程序时,它在128到130之间变化,在不同的值上random_str.
md5_bin = bin(int(hashlib.md5(random_str).hexdigest(),16))`
print len(md5_bin)
Run Code Online (Sandbox Code Playgroud)