PROBLEM:
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.
POTENTIAL SOLUTION
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?))
map
personally but after reading Hadley's R for Data Science book, I think this may be a case formap2
since you have two columns to use. – Alrzc