store                 package:Hmisc                 R Documentation

_S_t_o_r_e _a_n _O_b_j_e_c_t _P_e_r_m_a_n_e_n_t_l_y

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

     By default, 'store' will copy the object to '.Data' under the same
     name.  This function is most useful when you have attached a data
     frame or a temporary directory in position 1.  'store' is also
     useful for setting up to store later objects in a temporary work
     area ('.Data.tempnnnn', where 'nnnn' is a number computed by the
     system) so that they are not stored on disk.  For this usage, just
     invoke 'store' with no arguments, i.e., 'store()'.  After that,
     you can still invoke 'store' with arguments so that the object is
     copied to permanent storage.  Another function, 'stores' is useful
     for storing a series of temporary objects in '.Data' with one
     call.  'store' and 'stores' are not available For R.  See Details
     below for a method of approximating the use of 'store' in R.

     'storeTemp' stores an object in frame 0 for S-Plus or in a
     temporary environment '.GlobalTemp' in R, attaching that
     environment if it is not already attached, so that the objects are
     easily available.

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

     store(object, name=as.character(substitute(object)),
           where=if (under.unix || .SV4.) ".Data" else "_Data")
     stores(...)
     storeTemp(object, name=deparse(substitute(object)))

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

  object: object to store (omit to set search list position one to a 
          temporary directory created by 'store') 

    name: name under which to store the object. Default is name of
          object in call to 'store()'. 

   where: directory in which to store object. Default is '.Data'
          underneath current directory (for UNIX) or position 2 in the
          search list (for Windows). For R the default is '.GlobalEnv'. 

     ...: a list of objects to store in '.Data' or '.GlobalEnv'
          permanently, using names which are the same as the argument
          names 

_D_e_t_a_i_l_s:

     To almost mimic the functionality of 'store' or 'stores' in R, you
     can do the following.  Use 'save(x,y,z,file="Permdata")' to save
     permanent objects in '"permdata"'.  When you exit R, do not save
     the workspace.  Then all temporary objects will disappear.  In
     your '.Rprofile' put the command 'load("Permdata")' so that the
     next time you invoke R the permanent objects will be available.

_S_i_d_e _E_f_f_e_c_t_s:

     uses 'assign' and 'attach' functions.  'store' with no arguments
     also stores a function '.Last' in '.Data.tempnnnn', which will
     cause '.Data.tempnnnn' to be removed when the S session ends. For
     S-Plus, 'store()' causes creation of a system option named
     '.store.temp' which contains the name of the temporary directory
     created.

_S_e_e _A_l_s_o:

     'assign', '.Last', 'attach', 'search'

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

     ## Not run: 
     attach(database, 1)     #this database takes precedence
     store()                 #new objects to go under database in memory
                             #this doesn't work in R
     f <- lm(y ~ x)
     store(f)                #store f under name "f" in .Data or .GlobalEnv
                             #uses assign() with immediate=T
     store(f, "final.model") #immediately store f under "final.model" in .Data
     store()                 #store future objects in .Data.tempnnnn
     x <- runif(1000)        #x will disappear at session end unless
     store(x)                #this statement appears -> store in .Data
     stores(x, y, z)         #store x,y,z in .Data under names x,y,z
     storeTemp(x)            #put x as name 'x' in frame 0
                             #for R, attach .GlobalTemp and store it there
     storeTemp(x,'X')        #same as previous but under the name X
     ## End(Not run)

