Open EmilHvitfeldt opened 2 years ago
Think a lot about this should work on characters/factors. How should factor levels be handled
think about keyword "lump/collapse"
use fct_collapse()
internally to update the levels
library(forcats)
dict <- list(missing = c("No answer", "Don't know"),
other = "Other party",
rep = c("Strong republican", "Not str republican"),
ind = c("Ind,near rep", "Independent", "Ind,near dem"),
dem = c("Not str democrat", "Strong democrat"))
fct_collapse(gss_cat$partyid, !!!dict)
Way to combine levels in factor variables. I will henceforth be calling this action
lump
ing.There are two main ways we can go about doing this:
Target agnostic
Target based
References
https://arxiv.org/pdf/2104.00629.pdf