remove                 package:base                 R Documentation

_R_e_m_o_v_e _O_b_j_e_c_t_s _f_r_o_m _a _S_p_e_c_i_f_i_e_d _E_n_v_i_r_o_n_m_e_n_t

_D_e_s_c_r_i_p_t_i_o_n:

     'remove' and 'rm' can be used to remove objects.  These can be
     specified successively as character strings, or in the character
     vector 'list', or through a combination of both.  All objects thus
     specified will be removed.

     If 'envir' is NULL then the the currently active environment is
     searched first.

     If 'inherits' is 'TRUE' then parents of the supplied directory are
     searched until a variable with the given name is encountered.  A
     warning is printed for each variable that is not found.

_U_s_a_g_e:

     remove(..., list = character(0), pos = -1, envir = as.environment(pos),
            inherits = FALSE)
     rm    (..., list = character(0), pos = -1, envir = as.environment(pos),
            inherits = FALSE)

_A_r_g_u_m_e_n_t_s:

     ...: the objects to be removed, supplied individually and/or as a
          character vector

    list: a character vector naming objects to be removed.

     pos: where to do the removal.  By default, uses the current
          environment.  See the details for other possibilities.

   envir: the 'environment' to use. See the details section.

inherits: should the enclosing frames of the environment be inspected?

_D_e_t_a_i_l_s:

     The 'pos' argument can specify the  environment from which to
     remove the objects in any of several ways: as an integer (the
     position in the 'search' list); as the character string name of an
     element in the search list; or as an 'environment' (including
     using 'sys.frame' to access the currently active function calls).
     The 'envir' argument is an alternative way to specify an
     environment, but is primarily there for back compatibility.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'ls', 'objects'

_E_x_a_m_p_l_e_s:

     tmp <- 1:4
     ## work with tmp  and cleanup
     rm(tmp)

     ## Don't run: 
     ## remove (almost) everything in the working environment.
     ## You will get no warning, so don't do this unless you are really sure.
     rm(list = ls())
     ## End Don't run

