Comments (5)
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.
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 count
s, and prop
for least/most common fraction.
Another function is an overkill IMO.
from forcats.
Any progress on this?
from forcats.
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.
I'm pretty sure this is fct_lump_min()
from forcats.
Related Issues (20)
- Release forcats 1.0.0
- Update `fct_reorder2()`
- Make forcats 1.0.0 Tidyverse blog article more instructive HOT 1
- fct_recode removes `label` attribute HOT 4
- fct_na_value_to_level() adds a level for NA value even if it is not need HOT 1
- `fct_reorder2()` drops values HOT 1
- Assigning a level to NULL in fct_collapse does not remove it.... HOT 1
- "fct_na_value_to_level" not worked well in gtsummary HOT 1
- fct_relevel not working HOT 2
- Errors in `fct_reorder2` documentation
- Feature request: rename `fct_na_value_to_level` etc to `fct_na_to_level` etc as more readable HOT 1
- Document `fct_lump()` in own file
- Upkeep for forcats (2022)
- Feature Request: fct_trim()
- ```fct_reorder``` treatment of missing values in .x depends on whether .f is a factor or a character vector
- `fct_cross()` orders levels by second factor before the first factor
- Could fct_reorder be easier to use for where `.desc = TRUE`?
- Feature Request: Add handling of ordered factors to fct()
- Feature Request: Allow Increasing Order in `fct_infreq`
- Typo in Introduction
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forcats.