reconhub / linelist

An R package to import, clean, and store case data
https://www.repidemicsconsortium.org/linelist
Other
25 stars 5 forks source link

Spurious level added to output in top_values #96

Closed thibautjombart closed 4 years ago

thibautjombart commented 5 years ago

In the following minimal example:

top_values(factor(c('a', 'b'))[-1], n = 1)
#> [1] b
#> Levels: b other

The levels should not include other, but only b. This is likely related to this warning, happening in conjunction with subset:

x <- c("b", "b", "b")
x_subset <- c(FALSE, TRUE, TRUE)
top_values(x = x, n = 1, subset = x_subset)
#> [1] "b" "b" "b"
#> Warning message:
#> Unknown levels in `f`: other
thibautjombart commented 5 years ago

@zkamvar Great if you can have a look at some point.