Export list of data frames to files
Use export
to export a list of data frames to a vector of file names or a filename pattern.
export_list(x, file, ...)
x |
A list of data frames to be written to files. |
file |
A character vector string containing a single file name with a |
... |
Additional arguments passed to |
export
can export a list of data frames to a single multi-dataset file (e.g., an Rdata or Excel .xlsx file). Use export_list
to export such a list to multiple files.
The name(s) of the output file(s) as a character vector (invisibly).
library('datasets') export(list(mtcars1 = mtcars[1:10,], mtcars2 = mtcars[11:20,], mtcars3 = mtcars[21:32,]), "mtcars.xlsx") # import all worksheets mylist <- import_list("mtcars.xlsx") # re-export as separate named files export_list(mylist, file = paste0("mtcars", 1:3, ".csv")) # re-export as separate files using a name pattern export_list(mylist, file = "%s.csv") # cleanup unlink("mtcars.xlsx") unlink("mtcars1.csv") unlink("mtcars2.csv") unlink("mtcars3.csv")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.