2011-01-20 22 views
28

可能重复:
detecting operating system in R (e.g. for adaptive .Rprofile files)
How can I determine in R what platform I'm running on?如何R内部检查操作系统

是否有R A原函数上的R运行,将返回有关系统的信息?我主要关注操作系统,但其他任何数据都可能有帮助。

+1

看起来像重复[在R中检测操作系统(例如对于自适应.Rprofile文件)](http://stackoverflow.com/questions/4463087/detecting-operating-system-in-reg-for-adaptive-rprofile-文件) – Marek 2011-01-20 13:40:53

+1

而这一个:http://stackoverflow.com/questions/3919621/how-can-i-determine-in-r-what-platform-im-running-on/3922058#3922058 – 2011-01-20 13:50:18

回答

33

有关系统的所有信息使用Sys.info()Sys.info()['sysname']给你的操作系统。

R.Version()为您提供R的版本,包括您正在运行的架构(32位 - i386 - 与64位 - x64 - )。

R.home()system.file(package="xxx")为您提供根区域的位置信息。包文件。

25

这里有三种方式:

> .Platform$OS.type 
[1] "unix" 
> version$os ## or R.version$os 
[1] "linux-gnu" 
> Sys.info()["sysname"] 
sysname 
"Linux" 

看看?Sys.info的一些细节和附加条件。