commandArgs               package:base               R Documentation

_E_x_t_r_a_c_t _C_o_m_m_a_n_d _L_i_n_e _A_r_g_u_m_e_n_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Provides access to a copy of the command line arguments supplied
     when this R session was invoked.

_U_s_a_g_e:

     commandArgs(trailingOnly = FALSE)

_A_r_g_u_m_e_n_t_s:

trailingOnly: logical.  Should only arguments after '--args' be
          returned?

_D_e_t_a_i_l_s:

     These arguments are captured before the standard R command line
     processing takes place.  This means that they are the unmodified
     values.  This is especially useful with the '--args' command-line
     flag to R, as all of the command line after that flag is skipped.

_V_a_l_u_e:

     A character vector containing the name of the executable and the
     user-supplied command line arguments.  The first element is the
     name of the executable by which R was invoked.  The exact form of
     this element is platform dependent: it may be the fully qualified
     name, or simply the last component (or basename) of the
     application, or for an embedded R it can be anything the
     programmer supplied.

     If 'trailingOnly = TRUE', a character vector of those arguments
     (if any) supplied after '--args'.

_S_e_e _A_l_s_o:

     'Startup' 'BATCH'

_E_x_a_m_p_l_e_s:

     commandArgs()
     ## Spawn a copy of this application as it was invoked,
     ## subject to shell quoting issues
     ## system(paste(commandArgs(), collapse=" "))

