detach                 package:base                 R Documentation

_D_e_t_a_c_h _O_b_j_e_c_t_s _f_r_o_m _t_h_e _S_e_a_r_c_h _P_a_t_h

_D_e_s_c_r_i_p_t_i_o_n:

     Detach a database, i.e., remove it from the `search()' path of
     available R objects. Usually, this either a `data.frame' which has
     been `attach'ed or a package which was required previously.

_U_s_a_g_e:

     detach(name, pos = 2)

_A_r_g_u_m_e_n_t_s:

    name: The object to detach.  Defaults to `search()[pos]'. This can
          be a name or a character string but not a character vector. 

     pos: Index position in `search()' of database to detach.  When
          `name' is `numeric', `pos = name' is used. 

_V_a_l_u_e:

     The attached database is returned invisibly, either as
     `data.frame' or as `list'.

_N_o_t_e:

     You cannot detach either the workspace (position 1) or the `base'
     package (the last item in the search list).

_S_e_e _A_l_s_o:

     `attach', `library', `search', `objects'.

_E_x_a_m_p_l_e_s:

     require(eda)#package
     detach(package:eda)
     ## could equally well use detach("package:eda")
     ## but NOT  pkg <- "package:eda"; detach(pkg)
     ## Instead, use
     library(eda)
     pkg <- "package:eda"
     detach(pos = match(pkg, search()))

     library(mva)
     detach(2)# `pos' used for `name'

