ft_rollup | R Documentation |
Aggregates the levels of a factor vector based on another grouping vector.
ft_rollup(factor_vec, groups)
factor_vec |
A factor vector to aggregate. |
groups |
A vector of the same length as |
A factor vector with aggregated levels.
Kai Guo
# Example factor vector and groups
factor_vec <- factor(c('apple', 'banana', 'cherry', 'date', 'fig'))
groups <- c('fruit', 'fruit', 'fruit', 'dry fruit', 'dry fruit')
# Aggregate levels based on groups
ft_rollup(factor_vec, groups)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.