Skip to content

fct_lump_prop() has undocumented feature for one other level #274

@caneff

Description

@caneff

There is nothing in documentation that says lumping into other does nothing if that is only one other category. I don't mind the behavior but I spent some time debugging my code because of it.

What happens:

library(forcats)
f <- factor(c(1,2,2,2))
fct_lump_prop(f, prop=0.5)
#> [1] 1 2 2 2
#> Levels: 1 2

Created on 2020-10-01 by the reprex package (v0.3.0)

However I expect it to look like

#> [1] Other 2 2 2 2
#> Levels: 2 Other

Again I'm fine with the current behavior it is just unexpected for how the function reads. 1 is less than the 50% of the total so I expected it to become other. So either update documentation or behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions