append_group: Append Group

Description Usage Arguments Examples

View source: R/append_group.R

Description

Creates a new category level by combining existing levels. Appends new observations to dataset.

Usage

1
append_group(df, group_var, formula, drop = FALSE)

Arguments

df

data.frame or data.table

group_var

unquoted variable name of categorical variable

formula

a formula, LHS ~ RHS. The LHS side denotes the new level label. The RHS denotes the categories to be combined. For example: `Species starting with V` ~ versicolor + verginica.

drop

TRUE/FALSE. If FALSE, the resulting dataframe will include the original data plus observations with the new category level (rows will be duplicated). If TRUE, the command will eliminate rows in the original data with the old category levels (rows are not duplicated). Default is FALSE.

Examples

1
2
append_group(iris, `Species starting with V` ~ versicolor + virginica)
append_group(iris, `Species starting with V` ~ versicolor + virginica, drop = TRUE)

thomasgstewart/tgsify documentation built on June 18, 2020, 11:10 a.m.