ft_split_levels | R Documentation |
Splits the levels of a factor vector into multiple factors based on a specified delimiter.
ft_split_levels(factor_vec, delimiter, names = NULL)
factor_vec |
A factor vector to split. |
delimiter |
A character string used to split the factor levels. |
names |
A character vector specifying names for the resulting factors. Default is |
A data frame containing the resulting factors.
Kai Guo
# Example factor vector
factor_vec <- factor(c('red_large', 'blue_small', 'green_medium'))
# Split levels into two factors
ft_split_levels(factor_vec, delimiter = '_')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.