replace_if | R Documentation |
Currently only replacing values below a specified abundance is implemented
replace_if(vec, count_below = NULL, replacement)
vec |
vector with values to replace |
count_below |
replace values that occur less often than this threshold |
replacement |
value that is used for replacement |
example_vec = sample(letters[1:4], 1000,replace=T, prob=c(0.5,0.3,0.1,0.1))
table(example_vec)
replaced_vec = replace_if(example_vec, count_below=200, replacement = 'rare letter')
head(replaced_vec)
table(replaced_vec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.