Skip to content

fct_lump_prop() errors with weights and unused levels #292

Closed
@sam-crawley

Description

@sam-crawley

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:

f <- factor(c("a", "b", "c"), levels = c("a", "b", "c", "d"))
f <- fct_lump_prop(f, prop = 0.02,  w = c(1,1,1))

Calling fct_drop() beforehand prevents the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorhelp wanted ❤️we'd love your help!

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions