-
Notifications
You must be signed in to change notification settings - Fork 126
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
Turn levels into numbers #18
Comments
or gss_cat %>%
mutate(partyid = fct_recode(partyid,
"Republican, strong" = -3,
"Republican, weak" = -2,
"Independent, near republican" = -1,
"Indepedent" = 0,
"Independent, near democrat" = 1,
"Democrat, weak" = 2,
"Democrat, strong" = 3
)) %>%
count(partyid) |
For this to work naturally the new/old order needs to be flipped :/ |
@lionel- any thoughts here? |
Hmm... Could forcats reuse the dplyr's tools for recoding? Then we have ``-3 Can this be an alias to PS: just saw the emojis on the repo page, had a good laugh :) |
This would be exactly what I need. |
In dplyr 1.1, this will be |
Would be useful to have some moderately easy way to turn into a numeric vector. It wouldn't be magic (i.e. it wouldn't compute mean of values) - it would work like
fct_revalue()
, but create numeric vector, and unmentioned levels would become NAs.The text was updated successfully, but these errors were encountered: