本文介绍了在R中检测操作系统(例如,针对自适应.Rprofile文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在R中自动检测操作系统,例如将内容放置在.Rprofile中.
I was wondering how to automatically detect operating system in R, for example to place things in the .Rprofile.
推荐答案
我不确定是否要使用Sys.info()
,因为帮助页面上说它不是在所有R平台上都实现的;也许改用.Platform
吗? ?.Platform
具有很多有用的信息,因为:
I'm not sure about using Sys.info()
since the help page says it is not implemented on all R platforms; maybe use .Platform
instead? ?.Platform
has a lot of useful information, since:
似乎R附带的软件包比Sys.info
更频繁地使用.Platform
.
It also seems the packages included with R use .Platform
much more frequently than Sys.info
.
josh: /c/R/R-2.12.0-src/src/library
> grep ".Platform" */R/* | wc -l
144
josh: /c/R/R-2.12.0-src/src/library
> grep ".Platform\$OS.type" */R/* | wc -l
99
josh: /c/R/R-2.12.0-src/src/library
> grep "Sys.info" */R/* | wc -l
4
这篇关于在R中检测操作系统(例如,针对自适应.Rprofile文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!