dump                  package:base                  R Documentation

_T_e_x_t _R_e_p_r_e_s_e_n_t_a_t_i_o_n_s _o_f _R _O_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     This function takes a vector of names of R objects and produces
     text representations of the objects on a file or connection. A
     'dump' file can usually be 'source'd into another R (or S)
     session.

_U_s_a_g_e:

     dump(list, file = "dumpdata.R", append = FALSE, 
          control = "all", envir = parent.frame(), evaluate = TRUE)

_A_r_g_u_m_e_n_t_s:

    list: character. The names of one or more R objects to be dumped.

    file: either a character string naming a file or a connection. 
          '""' indicates output to the console.

  append: if 'TRUE', output will be appended to 'file'; otherwise, it
          will overwrite the contents of 'file'.

 control: character vector indicating deparsing options. See
          '.deparseOpts' for their description.

   envir: the environment to search for objects.

evaluate: logical.  Should promises be evaluated?

_D_e_t_a_i_l_s:

     If some of the objects named do not exist (in scope), they are
     omitted, with a warning.  If 'file' is a file and no objects exist
     then no file is created.

     At present 'source'ing may not produce an identical copy of
     'dump'ed objects. A warning is issued if it is likely that
     problems will arise, for example when dumping exotic objects such
     as environments and external pointers.

     'dump' will also warn if fewer characters were written to a file
     than expected, which may indicate a full or corrupt file system.

     A 'dump' file can be 'source'd into another R (or perhaps S)
     session, but the function 'save' is designed to be used for
     transporting R data, and will work with R objects that 'dump' does
     not handle.

     To produce a more readable representation of an object, use
     'control = NULL'.  This will skip attributes, and will make other
     simplifications that make 'source' less likely to produce an
     identical copy.  See 'deparse' for details.

     To deparse the internal function representation rather than
     displaying the saved source, use 'control = c("keepInteger",
     "quoteExpressions",  "showAttributes", "warnIncomplete")'.  This
     will lose all formatting and comments, but may be useful in those
     cases where the saved source is no longer correct.

     Promises will normally only be encountered by users as a result of
     lazy-loading (when the default 'evaluate = TRUE' is essential) and
     after the use of 'delayedAssign', when 'evaluate = FALSE' might be
     intended.

_V_a_l_u_e:

     An invisible character vector containing the names of the objects
     which were dumped.

_N_o_t_e:

     The 'envir' argument was added at version 1.7.0, and changed the
     default search path for named objects to include the environment
     from which 'dump' was called.

     As 'dump' is defined in the base namespace, the 'base' package
     will be searched _before_ the global environment unless 'dump' is
     called from the top level or the 'envir' argument is given
     explicitly.

     To avoid the risk of a source attribute out of sync with the
     actual function definition, the source attribute of a function
     will never  be dumped as an attribute.

_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:

     'dput', 'dget', 'write'.
      'save' for a more reliable way to save R objects.

_E_x_a_m_p_l_e_s:

     x <- 1; y <- 1:10
     dump(ls(patt='^[xyz]'), "xyz.Rdmped")
     print(.Last.value)
     unlink("xyz.Rdmped")

