Platform {base} | R Documentation |
Platform Specific Variables
Description
.Platform
is a list with functions and variables as
components. This provides means to write OS portable R
code.
Usage
.Platform
Platform()
Details
Currently, .Platform <- Platform()
when R starts up.
Value
.Platform
is list with at least the following components:
OS.type |
character, giving the Operating System
(family) of the computer. One of the following values is returned:
|
file.sep |
character, giving the file separator,
used on your platform, e.g., |
dynlib.ext |
character, giving the file name extension of
dynamically loadable libraries, e.g., |
GUI |
character, giving the type of GUI in use, or
|
See Also
system
for invoking platform-specific system commands.
Examples
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
}