How to check the OS within R

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.


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.

Tags:

R

R Faq