.Platform {base}
Description
.Platform is a list with some details of the platform under which R was built. This provides means to write OS-portable R code.
Usage
.Platform
Values
A list with at least the following components:
- OS.type
- character string, giving the Operating System (family) of the computer. One of
"unix"or"windows". - file.sep
- character string, giving the file separator used on your platform:
"/"on both Unix-alikes and on Windows (but not on the once port to Classic Mac OS). - dynlib.ext
- character string, giving the file name extension of dynamically loadable libraries, e.g.,
".dll"on Windows and".so"or".sl"on Unix-alikes. (Note for Mac OS X users: these are shared objects as loaded bydyn.loadand not dylibs: seedyn.load.) - GUI
- character string, giving the type of GUI in use, or
"unknown"if no GUI can be assumed. Possible values are for Unix-alikes the values given via the -g command-line flag ("X11","Tk"),"AQUA"(running underR.appon Mac OS X),"Rgui"and"RTerm"(Windows) and perhaps others under alternative front-ends or embedded R. - endian
- character string,
"big"or"little", giving the endianness of the processor in use. This is relevant when it is necessary to know the order to read/write bytes of e.g. an integer or double from/to a connection: seereadBin. - pkgType
- character string, the preferred setting for
options("pkgType"). Values"source","mac.binary.leopard"and"win.binary"are currently in use. - path.sep
- character string, giving the path separator, used on your platform, e.g.,
":"on Unix-alikes and";"on Windows. Used to separate paths in environment variables such asPATHandTEXINPUTS. - r_arch
- character string, possibly
"". The name of an architecture-specific directory used in this build of R.
AQUA
.Platform$GUI is set to "AQUA" under the Mac OS X GUI, R.app. This has a number of consequences:
- the DISPLAY environment variable is set to
":0"if unset. - appends ‘/usr/local/bin’ to the PATH environment variable.
- the default graphics device is set to
quartz. - selects native (rather than Tk) widgets for the
graphics = TRUEoptions ofmenuandselect.list. - HTML help is displayed in the internal browser.
- The spreadsheet-like data editor/viewer uses a Quartz version rather than the X11 one.
See Also
R.version and Sys.info give more details about the OS. In particular, R.version$platform is the canonical name of the platform under which R was compiled. .Machine for details of the arithmetic used, and system for invoking platform-specific system commands.
Examples
## Note: this can be done in a system-independent way ## by file.info()$isdir if(.Platform$OS.type == "unix") { system.test <- function(...) { system(paste("test", ...)) == 0 } dir.exists <- function(dir) sapply(dir, function(d) system.test("-d", d)) dir.exists(c(R.home(), "/tmp", "~", "/NO"))# > T T T F }
Documentation reproduced from R 2.15.0. License: GPL-2.
