split_file_into: Split a file into multiple sheets/files

Description Usage Arguments Value Examples

View source: R/file_manips.R

Description

With a file or dataframe as input, possibility to ssplit it on a given variable and write to disk

Usage

1
split_file_into(df, out_file = NULL, split_by = NULL, into = "sheets")

Arguments

out_file

output file path(s)

into

one of "sheets" or "files"

file

input file path or a dataframe

Value

A File is written on provided path(s)

Examples

1
2
3
4
5
6
7
8
9
split_file_into(iris, out_file = "iris_splitted.xlsx", split_by = "Species", into = "sheets")
split_file_into(iris, out_file = "iris_splitted_%s.xlsx", split_by = "Species", into = "files")

# Giving a file path works too
rio::export(iris, "iris.xlsx")
split_file_into("iris.xlsx", out_file = "iris_splitted_%s.xlsx", split_by = "Species", into = "files")

# takes a single file and splits it by the column split_by.
# then write multiple files or a single file with multiple sheets

ismailmuller/ismisc documentation built on April 2, 2020, 12:05 a.m.