
Dumping data sets to Excel files
xlcDump.RdDumps data sets to Excel files by writing each object to a separate worksheet.
Arguments
- list
charactervector of names of objects inside environmentposto dump into an Excel file. Objects will be written usingwriteWorksheet- as such any object will be coerced to adata.frame. Ifmissing, the list of objects will be determined via the functionlswhich takes any arguments specified via ....- ...
Arguments that will be passed to the
lsfunction for getting a list of object names in case thelistargument ismissing.- file
Excel file to which objects will be dumped. Can be an existing or a new file. Defaults to
"dump.xlsx".- pos
Environment in which to look for objects. Can be specified either as an
integerspecifying the position in thesearchlist, as acharacternaming an element in thesearchlist or as anenvironment. Defaults to-1which refers to the current environment.- overwrite
logicalspecifying if data should be overwritten if objects with the same name have already been dumped to the Excelfile.
Details
Each object is written to a separate worksheet named by the name of the object. Objects are written using the
writeWorksheet method - as such any object will be coerced to data.frame.
Value
Named logical vector specifying if objects have been dumped or not. An object may not be dumped because there
was an issue with the coercion to a data.frame or the object already existed (and overwrite = FALSE) in
the workbook.
Author
Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch
Examples
if (FALSE) { # \dontrun{
require(datasets)
xlcDump(c("airquality", "CO2", "iris", "PlantGrowth", "swiss"),
file = "myDump.xlsx", pos = "package:datasets")
xlcRestore(file = "myDump.xlsx", overwrite = TRUE)
# clean up
file.remove("myDump.xlsx")
} # }