ft_apply | R Documentation |
Transforms factor levels by applying a function to each level.
ft_apply(factor_vec, apply_func)
factor_vec |
A factor vector to transform. |
apply_func |
A function to apply to each level. |
A factor vector with transformed levels.
Kai Guo
# Example factor vector
factor_vec <- factor(c('apple', 'banana', 'cherry'))
# Append '_fruit' to each level
ft_apply(factor_vec, function(x) paste0(x, '_fruit'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.