.Platform                package:base                R Documentation

_P_l_a_t_f_o_r_m _S_p_e_c_i_f_i_c _V_a_r_i_a_b_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     .Platform

_V_a_l_u_e:

     A list with at least the following components:

 OS.type: character string, giving the *O*perating *S*ystem (family) of
          the computer.  One of '"unix"' or '"windows"'. 

file.sep: character string, giving the *file* *sep*arator used on your
          platform: '"/"' on both Unix-alikes _and_ on Windows (but not
          on the now abandoned port to Classic MacOS). 

dynlib.ext: character string, giving the file name *ext*ension of
          *dyn*amically loadable *lib*raries, e.g., '".dll"' on Windows
          and '".so"' or '".sl"' on Unix-alikes.  (Note for Mac OS X
          users: these are shared objects as loaded by 'dyn.load' and
          not dylibs: see 'dyn.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"', '"GNOME"'), '"AQUA"' (running under
          'R.app' on MacOS 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: see 'readBin'.  

 pkgType: character string, the preferred setting for
          'options("pkgType")'.  Values '"source"', '"mac.binary"' and
          '"win.binary"' are currently in use. 

path.sep: character string, giving the *path* *sep*arator, used on your
          platform, e.g., '":"' on Unix-alikes and '";"' on Windows. 
          Used to separate paths in variables such as 'PATH' and
          'TEXINPUTS'. 

  r_arch: character string, possibly '""'.  The name of the
          architecture-specific directories used in this build of R. 

_S_e_e _A_l_s_o:

     '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.

_E_x_a_m_p_l_e_s:

     ## 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
     }

