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 functions and variables as components. 
     This provides means to write OS portable R code.

_U_s_a_g_e:

     .Platform
     Platform()

_D_e_t_a_i_l_s:

     Currently, `.Platform <- Platform()' when R starts up.

_V_a_l_u_e:

     `.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: `"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. 

     GUI: character, giving the type of GUI in use, or `"unknown"' if
          no GUI can be assumed. 

  endian: character, `"big"' or `"little"', giving the endianness of
          the processor in use. 

_S_e_e _A_l_s_o:

     `machine' for another view of the OS, `Sys.info' which gives more
     details about the OS, `.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
     }

