Sys.setenv               package:base               R Documentation

_S_e_t _o_r _U_n_s_e_t _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'Sys.setenv' sets environment variables (for other processes
     called from within R or future calls to 'Sys.getenv' from this R
     process).

     'Sys.unsetenv' removes environment variables.

_U_s_a_g_e:

     Sys.setenv(...)

     Sys.unsetenv(x)

_A_r_g_u_m_e_n_t_s:

     ...: named arguments with values coercible to a character string.

       x: a character vector, or an object coercible to character.

_D_e_t_a_i_l_s:

     The names 'setenv' and 'putenv' come from different Unix
     traditions: R also has 'Sys.putenv', but this is now deprecated.
     The internal code uses 'setenv' if available, otherwise 'putenv'.

     Non-standard R names must be quoted in 'Sys.setenv': see the
     examples.  Most platforms (and POSIX) do not allow names
     containing '"="'.

_V_a_l_u_e:

     A logical vector, with elements being true if (un)setting the
     corresponding variable succeeded.  (For 'Sys.unsetenv' this
     includes attempting to remove a non-existent variable.)

_N_o_t_e:

     Not all systems need support 'Sys.setenv' (although all known
     current platforms do) nor 'Sys.unsetenv'.

_S_e_e _A_l_s_o:

     'Sys.getenv', Startup for ways to set environment variables for
     the R session.

     'setwd' for the working directory.

_E_x_a_m_p_l_e_s:

     print(Sys.setenv(R_TEST="testit", "A+C"=123))  # `A+C` could also be used
     Sys.getenv("R_TEST")
     try(Sys.unsetenv("R_TEST"))  # may not be implemented
     Sys.getenv("R_TEST", unset=NA)

