[R] R in different OS

Marc Schwartz marc_schwartz at me.com
Fri Feb 25 21:56:04 CET 2011


On Feb 25, 2011, at 12:23 PM, Hui Du wrote:

> Hi All,
> 
>                I have two Rs, one has been installed in Windows system and another one has been installed under UNIX system. Is there any environmental variable or function to tell me which R I am using? The reason that I need to know it is under different system, the data path could be different. I want to do something like
> 
> if it is R under Windows
> 
>                path = "/ABC"
> else if it is R under UNIX,
>                path = "/DEF"
> 
> Any idea? Thanks.
> 
> Best Regards,
> 
> HXD


See ?.Platform, more specifically:

On Unixen (eg. Linux, OSX)

> .Platform$OS.type
[1] "unix"

and on Windows, will be "windows".

If needed, look at the additional functions listed in the See Also on the help page (eg. ?Sys.info, etc.).

HTH,

Marc Schwartz



More information about the R-help mailing list