[英]In R, what's the canonical way to detect if the OS is 64-bit?
Some possibilities include: 一些可能性包括:
Sys.info()["machine"] == "x86-64"
.Platform$r_arch == "x64"
version$arch == "x86_64"
Is there any reason to prefer one method over another? 是否有理由更喜欢一种方法而不是另一种方法?
Related: detecting operating system in R (eg for adaptive .Rprofile files) 相关: 检测R中的操作系统(例如,用于自适应.Rprofile文件)
Actually none of those methods would be canonical, which I take to mean "what would Brian Ripley say". 实际上,这些方法都不是规范的,我认为这意味着“Brian Ripley会说什么”。 Try this: 试试这个:
?.Machine
sizeof.pointer........the number of bytes in a C SEXP type. sizeof.pointer ........ C SEXP类型中的字节数。 Will be 4 on 32-bit builds and 8 on 64-bit builds of R. 在32位构建上将是4,在64位构建的R上将是8。
64bit <- .Machine$sizeof.pointer == 8
64bit
#[1] TRUE
As for your nominations only one of them returns TRUE on my machine: 至于你的提名,我的机器上只有其中一个返回TRUE:
> Sys.info()["machine"] == "x86-64"
machine
FALSE
> .Platform$r_arch == "x64"
[1] FALSE
> version$arch == "x86_64"
[1] TRUE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.