ft_replace_na | R Documentation |
Replaces NA
values in a factor vector with a specified level.
ft_replace_na(factor_vec, replacement_level)
factor_vec |
A factor vector. |
replacement_level |
A string specifying the level to replace |
A factor vector with NA
values replaced.
Kai Guo
# Example factor vector
factor_vec <- factor(c('apple', NA, 'banana', 'cherry', NA))
# Replace NAs with 'Unknown'
ft_replace_na(factor_vec, replacement_level = 'Unknown')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.