Skip to content
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_other() gives confusing "Unknown levels" warning #265

Closed
xelax opened this issue Jul 2, 2020 · 0 comments · Fixed by #327
Closed

fct_other() gives confusing "Unknown levels" warning #265

xelax opened this issue Jul 2, 2020 · 0 comments · Fixed by #327
Labels
bug an unexpected problem or unintended behavior help wanted ❤️ we'd love your help!
Milestone

Comments

@xelax
Copy link

xelax commented Jul 2, 2020

when no values in f triggers the generation of "Other" then a warning message is emitted. This is particularly troublesome on very large grouped datasets because you get a warning for each group and it takes forever to process it.

library(forcats)
fct_other(c("A"), keep="A")
#> Warning: Unknown levels in `f`: Other
#> [1] A
#> Levels: A
fct_other(c("A", "B"), keep="A")
#> [1] A     Other
#> Levels: A Other

Created on 2020-07-02 by the reprex package (v0.3.0)

@hadley hadley added the bug an unexpected problem or unintended behavior label Dec 9, 2020
@hadley hadley added the help wanted ❤️ we'd love your help! label Mar 2, 2022
@hadley hadley added this to the v1.0.0 milestone Jan 3, 2023
@hadley hadley changed the title incorrect "Unknown levels" error message in fct_other fct_other() gives confusing "Unknown levels" warning Jan 3, 2023
hadley added a commit that referenced this issue Jan 3, 2023
hadley added a commit that referenced this issue Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior help wanted ❤️ we'd love your help!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants