Export mapping each dataframe in a list to a corresponding .csv file.

list_csv(lst, dir, prefix = NULL)

Arguments

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.

Source

Adapted from an article by Jenny Bryan (https://goo.gl/ah8qkX).

See also

Other general functions to export data: list_df

Examples

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"