Giter Site home page Giter Site logo

Comments (5)

hadley avatar hadley commented on August 20, 2024

I don't like using prop in that way - it's starting to add too many meanings to a single argument, which I think makes it confusing. I'd rather add another argument or possible create another function.

from forcats.

vspinu avatar vspinu commented on August 20, 2024

I'd rather add another argument or possible create another function.

count might be a reasonable name for the new argument. Thus, n is for most/least common n levels, count for levels with at least/at most counts, and prop for least/most common fraction.

Another function is an overkill IMO.

from forcats.

akaEmma avatar akaEmma commented on August 20, 2024

Any progress on this?

from forcats.

ksedivyhaley avatar ksedivyhaley commented on August 20, 2024

I am also very interested in this feature.

In the meantime, I seem to have an ugly workaround. If I want to eg group items with over 2 occurrences:

#get the number of levels with more than 2 occurences

over_2 <-  sum( (count(  group_by(data, factor) ))$n>2 )

#plug this into fct_lump

data %>%
  mutate(factor = fct_lump(factor, n = over_2)

from forcats.

hadley avatar hadley commented on August 20, 2024

I'm pretty sure this is fct_lump_min()

from forcats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.