ID EN
System & OS

.Platform

R Base 3.6.2

.Platform is a list with some details of the platform under which R was built. This provides means to write OS-portable R code.

Syntax

R
.Platform

Return Value

A list with at least the following components: OS.typecharacter string, giving the Operating System (family) of the computer. One of "unix" or "windows". file.sepcharacter string, giving the file separator used on your platform: "/" on both Unix-alikes and on Windows (but not on the former port to Classic Mac OS). dynlib.extcharacter string, giving the file name extension of dynamically loadable libraries, e.g., ".dll" on Windows and ".so" or ".sl" on Unix-alikes. (Note for macOS users: these ar

Examples

Example
R
# NOT RUN {
## Note: this can be done in a system-independent way by dir.exists()
if(.Platform$OS.type == "unix") {
   system.test <- function(...) system(paste("test", ...)) == 0L
   dir.exists2 <- function(dir)
       sapply(dir, function(d) system.test("-d", d))
   dir.exists2(c(R.home(), "/tmp", "~", "/NO")) # > T T T F
}
# }

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. capabilities and extSoftVersion (and links there) for availability of capabilities partly external to R but used from R functions.