ID EN
Miscellaneous

dump

R Base 3.6.2

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 sourced into another R session.

Syntax

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

Arguments

Parameter Description
list character vector. 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 and file is a character string, 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?

Return Value

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

Details

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. sourceing may not produce an identical copy of dumped 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 sourced 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. For maximal reproducibility use control = c("all", "hexNumeric"). To produce a more readable representation of an object, use control =

Examples

Example
R
# NOT RUN {
x <- 1; y <- 1:10
fil <- tempfile(fileext=".Rdmped")
dump(ls(pattern = '^[xyz]'), fil)
print(.Last.value)
unlink(fil)
# }

See Also

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