You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(interlacer)
library(forcats)
foo<- interlaced(c("a", "a", "b", "b", "c", "OMITTED"), na="OMITTED") |>
map_value_channel(as.factor)
fct_lump_n(foo, 2, other_level="OTHER")
#> [1] a a b b OTHER <NA> #> attr(,"na_channel_values")#> [1] <NA> <NA> <NA> <NA> <NA> OMITTED#> Levels: OMITTED#> Levels: a b OTHER
Ah, it's from fct_lump_n -> lvls_other() -> fct_relevel() -> lvls_reorder() -> refactor(). refactor()overwrites the class attribute
So refactor() is written to preserve all the extended attributes of the original factor, but not extensions of the class? It seems like it'd be better if it also preserved the subclass of the factor as well...
Created on 2024-08-08 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: