include                package:memisc                R Documentation

_A_t_t_a_c_h _a _S_o_u_r_c_e _F_i_l_e _t_o _t_h_e _S_e_a_r_c_h _P_a_t_h

_D_e_s_c_r_i_p_t_i_o_n:

     Functions 'include' and 'uninclude' provide a simple mechanism for
     modularisation without the need to code a full-blown package.
     Functions in an 'include'd sourcefile are attached to the search
     path, but are not visible in the global environment. If an
     experienced user has written quite a number of utility functions
     for her/his daily work, but does not want to have listed them in
     each 'ls()' call, s/he can just 'include' a source file containing
     these utility functions. 'uninclude' just reverts the attachment
     of a source file into the search path. 'detach.sources' detaches
     all source files from the search path.

_U_s_a_g_e:

     include(filename,warn=FALSE)
     uninclude(filename)
     detach.sources()

_A_r_g_u_m_e_n_t_s:

filename: character string, path to a file containing R code.

    warn: logical value; should a warning issued if the file has
          already been 'include'd? 

_E_x_a_m_p_l_e_s:

     ## Not run: 
     include("~/R/my-functions.R")
     include("~/R/more-of-my-functions.R")

     ls() # The functions defined in these files will not show up here

     # ... but here
     search()
     ls("source:~/R/my-functions.R")
     ls("source:~/R/more-of-my-functions.R")

     z <- one.of.my.functions(100) # ... and are available.

     uninclude("~/R/my-functions.R") 

     detach.sources()  
     ## End(Not run)

