.Platform {base} | R Documentation |
.Platform
is a list with some details of the platform under
which R was built. This provides means to write OS-portable R
code.
.Platform
A list with at least the following components:
OS.type |
character string, giving the Operating System
(family) of the computer. One of |
file.sep |
character string, giving the file separator used on your
platform: |
dynlib.ext |
character string, giving the file name extension of
dynamically loadable libraries, e.g., |
GUI |
character string, giving the type of GUI in use, or |
endian |
character string, |
pkgType |
character string, the preferred setting for
|
path.sep |
character string, giving the path separator,
used on your platform, e.g., |
r_arch |
character string, possibly |
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.
## 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
}