group_write.Rd
group_write
splits a data frame according to (multiple) grouping variables, write out each
part with file name indicating specific groups.
group_write(df, ..., dir = "")
a data frame
grouping variables
output directory. By default, the output files are stored under the current working directory
group_write
returns the input data frame invisibly.
library(ymisc)
group_write(iris, Species)
list.files(pattern = "\\.csv$")
#> [1] "iris-setosa.csv" "iris-versicolor.csv" "iris-virginica.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