In R, write each nested data frame to a CSV


I have data frame of data frames from purrr and want to write each nested data frame to a CSV.

> df # A tibble: 3 × 2 dataset data <chr> <list> 1 aab <tibble [681 × 60]> 2 aae <tibble [1,486 × 173]> 3 acm <tibble [3,496 × 139]>

That is, I want 3 CSVs from above: one CSV for each tibble under "data".

I prefer tidyverse functions to lapply or similar.


I think it's gotta be something using map() or similar function:

df %>% map(~write_csv(data, file=[how to get filename from 'dataset' column?))


If you use purrr::by_row, you can access the dataset via .$dataset:

temp <- df %>% by_row(~write.csv(.$data, file = .$dataset))

This will save each tibble in a row to a separate file under the name of dataset.


  • Replace substring with nothing
  • How to search a Airport through IATA codes.Not by the Names
  • Trying to flip a triangle in assembly language
  • Postgres CSV COPY from/import is not respecting CSV headers
  • CSV formatting - strip qualifier from specific fields
  • N1QL Concatenate many children rows into single string
  • Insert casper javascript data to CSV file
  • php convert flat family list to tree
  • MySQL - Max() return wrong result
  • Move a ball on mouse click in Java
  • r markdown biblio-style does not work
  • Play PCM data in .NET Framework 2?
  • How to finish code to replace NA with median in R
  • passing named list to cols_only() [closed]
  • Batch file set command isn't working in if statement
  • Chop up bsplines and color them
  • In R, write each nested data frame to a CSV
  • Getting access to a binary response byte-by-byte in classic asp/JScript
  • PHP Script in my Wordpress Files. Please Decode or Help Me Remove it [closed]
  • Towers of Hanoi with “counter” in python
  • Referring to individual variables in … with dplyr quos
  • How do I make openssl_encrypt pad the input to the required block size?
  • Variant from android-autofittextview library : scaling makes strange behaviour
  • Stacked Bar Chart with percentage composition inside the Bar and total above the Bar in JFreeChart
  • Using multiple input pipelines in TensorFlow
  • Can you use DataSet and DataTables in a Portable Class Library
  • Does the Azure table storage API cache results?
  • in batch how do i use taskkill properly
  • Local Development, Apache vs Developer - file permissions
  • How to return DataSet (xsd) in WCF
  • json Serialization in asp
  • Turn off referential integrity in Derby? is it possible?
  • Add sale price programmatically to product variations
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • java string with new operator and a literal
  • How do I use LINQ to get all the Items that have a particular SubItem?