Closed sam-crawley closed 1 year ago
Reprex:
library(forcats)
f <- factor(c("a", "a", "b", "c"), levels = c("a", "b", "c", "d"))
fct_lump_prop(f, prop = 0.25)
#> [1] a a Other Other
#> Levels: a Other
fct_lump_prop(f, prop = 0.25, w = rep(1, 4))
#> Error in if (prop > 0 && sum(prop_n <= prop) <= 1) {: missing value where TRUE/FALSE needed
Created on 2022-03-02 by the reprex package (v2.0.1)
When calling fct_lump_prop with weights, and with a factor that has unused levels, I get the error:
Error in if (prop > 0 && sum(prop_n <= prop) <= 1) { : missing value where TRUE/FALSE needed
Reprex:
Calling fct_drop() beforehand prevents the error.