R/list_output.R
list_csv.Rd
Export mapping each dataframe in a list to a corresponding .csv file.
list_csv(lst, dir, prefix = NULL)
lst | A list of dataframes. |
---|---|
dir | Character; the directory where the files will be saved. |
prefix | Character; a prefix to add to the file names. |
Adapted from an article by Jenny Bryan (https://goo.gl/ah8qkX).
Other general functions to export data: list_df
lst <- list(df1 = data.frame(x = 1), df2 = data.frame(x = 2)) # Saving the output to a temporary file output <- tempdir() list_csv(lst, output, prefix = "myfile-") # Look inside the output directory to confirm it worked dir(output, pattern = "myfile")#> [1] "myfile-df1.csv" "myfile-df2.csv"