append_group | R Documentation |
Creates a new category level by combining existing levels. Appends new observations to dataset.
append_group(df, group_var, formula, drop = FALSE)
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: |
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. |
append_group(iris, `Species starting with V` ~ versicolor + virginica)
append_group(iris, `Species starting with V` ~ versicolor + virginica, drop = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.