group_write: Divide a data frame into groups and write multiple csv files

View source: R/group_write.R

group_writeR Documentation

Divide a data frame into groups and write multiple csv files

Description

group_write splits a data frame according to (multiple) grouping variables, write out each part with file name indicating specific groups.

Usage

group_write(df, ..., dir = "")

Arguments

df

a data frame

...

grouping variables

dir

output directory. By default, the output files are stored under the current working directory

Value

group_write returns the input data frame invisibly.

Examples

library(ymisc)
group_write(iris, Species)
list.files(pattern = "\\.csv$")

# Currently, you need to convert `df` into a data frame outside this function
# before passing the argument.
# For example, `group_write(as.data.frame(Titanic), Sex, Age)` does not work

enixam/ymisc documentation built on Nov. 22, 2022, 1:31 a.m.