dump
file can usually be source
d into another
R (or S) session.
dump(list, file = "dumpdata.R", append = FALSE, control = "all", envir = parent.frame(), evaluate = TRUE)
""
indicates output to the console.TRUE
and file
is a character string,
output will be appended to file
; otherwise, it will overwrite
the contents of file
..deparseOpts
for their description.file
is a file and no objects
exist then no file is created. 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 or complex
objects (see the Note).
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 representation of a function rather than
displaying the saved source, use control = c("keepInteger",
"warnIncomplete", "keepNA")
. 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.
dput
, dget
, write
.
save
for a more reliable way to save R objects.
x <- 1; y <- 1:10
dump(ls(pattern = '^[xyz]'), "xyz.Rdmped")
print(.Last.value)
unlink("xyz.Rdmped")
Run the code above in your browser using DataLab