[R] Operating System Variable
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Mar 5 16:12:40 CET 2010
See
?R.version
?Sys.info
?.Platform
On Windows, ?win.version
It all depends what you mean by 'Operating System'.
On Fri, 5 Mar 2010, Rob Helpert wrote:
> Hi.
>
> Is there an easy way (analogous to the $^O variable in perl) to find
That's a pretty basic description. Even R.version$os often gives more
info. E.g.
gannet% Rscript -e 'R.version$os'
[1] "linux-gnu"
gannet% perl -e 'print "$^O\n"'
linux
blacklark% Rscript -e 'R.version$os'
[1] "darwin9.8.0"
blacklark% perl -e 'print "$^O\n"'
darwin
blackhawk% Rscript -e 'R.version$os'
[1] "solaris2.10"
blackhawk% perl -e 'print "$^O\n"'
solaris
but note that on binary versions of R you may get the OS which it was
compiled under (as in blacklark, which is running Mac OS X 10.6.2 aka
Darwin 10.2.0) and that the name may be neither the name the OS itself
reports nor the commonly used name. (Darwin vs Mac OS X, SunOS vs
Solaris are examples.)
system('uname -s', intern=TRUE)
may be closer to what you are looking for (except on Windows).
> out what operating system R is currently using?
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list