df_split_col: Split string/factor column

View source: R/df_split_col.R

df_split_colR Documentation

Split string/factor column

Description

Given a data frame x, a column name and a naming scheme, the function splits every element in x[[split.col]], using the naming scheme. Next, either a data frame with column names indicating the split parts for each unique value in x[[split.col]] is returned, or, if append=TRUE, this data frame is left-joined with x by split.col.

Usage

df_split_col(x, split.col, scheme, delim, append = TRUE)

Arguments

x

[data.frame]
Source data frame.

split.col

[string]
Column name of column used for splitting.

scheme

[string]
Single string encoding the names and types of the split parts. E.g. “group{c}/problem{c}_n{i}_m{i}/algorithm{c}_pc{r}”. Passed down to decode_scheme.

delim

[character]
Set of characters used to split the entries in the column.

append

[logical(1)]
Should the splitted data be appended to x by split.col? Default is FALSE.

Value

Modified data frame.

See Also

Other data frame helpers: df_add_category(), df_add_constant_columns(), df_explode(), df_rows_to_list()


jakobbossek/re documentation built on Nov. 15, 2024, 1:42 a.m.