autoload                package:base                R Documentation

_O_n-_d_e_m_a_n_d _L_o_a_d_i_n_g _o_f _P_a_c_k_a_g_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'autoload' creates a promise-to-evaluate 'autoloader' and stores
     it with name 'name' in '.AutoloadEnv' environment. When R attempts
     to evaluate 'name', 'autoloader' is run, the package is loaded and
     'name' is re-evaluated in the new package's environment.  The
     result is that R behaves as if 'file' was loaded but it does not
     occupy memory.

     '.Autoloaded' contains the names of the packages for which
     autoloading has been promised.

_U_s_a_g_e:

     autoload(name, package, reset = FALSE, ...)
     autoloader(name, package, ...)

     .AutoloadEnv
     .Autoloaded

_A_r_g_u_m_e_n_t_s:

    name: string giving the name of an object.

 package: string giving the name of a package containing the object.

   reset: logical: for internal use by 'autoloader'.

     ...: other arguments to 'library'.

_V_a_l_u_e:

     This function is invoked for its side-effect.  It has no return
     value.

_S_e_e _A_l_s_o:

     'delayedAssign', 'library'

_E_x_a_m_p_l_e_s:

     require(stats)
     autoload("interpSpline", "splines")
     search()
     ls("Autoloads")
     .Autoloaded

     x <- sort(stats::rnorm(12))
     y <- x^2
     is <- interpSpline(x,y)
     search() ## now has splines
     detach("package:splines")
     search()
     is2 <- interpSpline(x,y+x)
     search() ## and again
     detach("package:splines")

