-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fct_lump_prop()
has undocumented feature for one other level
#274
Comments
Just ran into the same issue, also with library(forcats)
fct_lump_n(c("a","a","c"), n=1)
#> [1] a a c
#> Levels: a c
fct_lump_n(c("a","a","b","c"), n=1)
#> [1] a a Other Other
#> Levels: a Other Created on 2021-01-30 by the reprex package (v0.3.0) |
I think the behaviour makes sense because what's the point in having an "other" level that contains only one level? |
If for nothing else, then for 1) consistency among the
Any in case you want to change the
And this will work correctly even if there is only one such institution. |
fct_lump_prop()
has undocumented feature for one other level
Ok; let's just hope this doesn't affect too much code in the wild. |
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:
Created on 2020-10-01 by the reprex package (v0.3.0)
However I expect it to look like
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.
The text was updated successfully, but these errors were encountered: