Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the OS within R [duplicate]

Tags:

r

r-faq

Possible Duplicates:
detecting operating system in R (e.g. for adaptive .Rprofile files)
How can I determine in R what platform I'm running on?

Is there a primitive function in R that will return information about the system on which R is running? I am concerned primarily with the OS, but any other data could be helpful.

like image 519
gappy Avatar asked Jan 20 '11 13:01

gappy


2 Answers

use Sys.info() for all information about the system, Sys.info()['sysname'] gives you the OS.

R.Version() gives you the version of R, including which architecture you're running (32bit - i386 - versus 64bit - x64 - ).

R.home() and system.file(package="xxx") give you information of the location of the root resp. the package files.

like image 190
Joris Meys Avatar answered Nov 02 '22 13:11

Joris Meys


Here are three ways:

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

Take a look at ?Sys.info for some details and provisos.

like image 24
Gavin Simpson Avatar answered Nov 02 '22 11:11

Gavin Simpson