Skip to content

fct_infreq() should support weights #261

@krlmlr

Description

@krlmlr

similarly to fct_lump() .

library(forcats)

x <- letters[c(1:3, 2)]
w <- c(4, 1, 3, 1)

x
#> [1] "a" "b" "c" "b"
w
#> [1] 4 1 3 1

fct_infreq(x)
#> [1] a b c b
#> Levels: b a c

fct_infreq(x, w = w)
#> Error in fct_infreq(x, w = w): unused argument (w = w)

# Should behave like:
fct_reorder(x, w, sum, .desc = TRUE)
#> [1] a b c b
#> Levels: a c b

Created on 2020-04-27 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementhelp wanted ❤️we'd love your help!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions