ft_filter_func | R Documentation |
Removes levels from a factor vector based on a user-defined function.
ft_filter_func(factor_vec, func)
factor_vec |
A factor vector to filter. |
func |
A function that takes a character vector of levels and returns a logical vector. |
A factor vector with levels filtered according to the function.
Kai Guo
# Example factor vector
factor_vec <- factor(c('apple', 'banana', 'cherry', 'date'))
# Remove levels that start with 'b'
ft_filter_func(factor_vec, function(x) !grepl('^b', x))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.