

   Platform {base}                              R Documentation

   PPllaattffoorrmm SSppeecciiffiicc VVaarriiaabblleess

   DDeessccrriippttiioonn::

        `.Platform' is a list with functions and variables as
        components.  This provides a possibility to write OS
        portable R code.  However, this interface is still
        somewhat experimental.

        Currently, `.Platform <- Platform()' when R starts up.
        This is even more experimental.

   UUssaaggee::

        .Platform
        Platform()

   VVaalluuee::

        `.Platform' is list with at least the following compo-
        nents:

    OS.type: character, giving the Operating System (family) of
             the computer.  One of the following values is
             returned: `"unix"',  `"mac"', or  `"windows"' (in
             historical order).

   file.sep: character, giving the file separator, used on your
             platform, e.g., `"/"' on Unix alikes.

   dynlib.ext: character, giving the file name extension of
             dynamically loadable libraries, e.g., `".dll"' on
             Windows.

   SSeeee AAllssoo::

        `system' for invoking platform specific system com-
        mands.

   EExxaammpplleess::

        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
        }

