is.R                  package:base                  R Documentation

_A_r_e _w_e _u_s_i_n_g _R, _r_a_t_h_e_r _t_h_a_n _S?

_D_e_s_c_r_i_p_t_i_o_n:

     Test if running under R.

_U_s_a_g_e:

     is.R()

_D_e_t_a_i_l_s:

     The function has been written such as to correctly run in all
     versions of R, S and S-PLUS. In order for code to be runnable in
     both R and S dialects, either your the code must define 'is.R' or
     use it as

     'if (exists("is.R") && is.function(is.R) && is.R()) {'
      '    '_## R-specific code_
      '} else {'
      '    '_## S-version of code_
      '}'

_V_a_l_u_e:

     'is.R' returns 'TRUE' if we are using R and 'FALSE' otherwise.

_S_e_e _A_l_s_o:

     'R.version', 'system'.

_E_x_a_m_p_l_e_s:

     x <- runif(20); small <- x < 0.4
     ## 'which()' only exists in R:
     if(is.R()) which(small) else seq(along=small)[small]

