问题描述
我有调查数据,许多问题的水平都超过2,例如性别。我想编辑和删除级别。我试图整洁地使用forcats函数,但我似乎总是碰壁。我目前正在尝试将性别缩小到只有几个(全都是男性)(现在我有“男”,“男”,“男”,“男同性恋”等)。我的口吻是“土狼”。
## recoding levels
coyote = coyote %>%
mutate(`What is your gender?` = recode(`What is your gender?`,male = c("boy","m")))
Error: Problem with `mutate()` input `What is your gender?`.
x `male` must be length 28 or one,not 2.
i Input `What is your gender?` is `recode(`What is your gender?`,"m"))`.
Run `rlang::last_error()` to see where the error occurred.
## dropping unnecessary levels
coyote = coyote %>% fct_drop(`What is your gender?`,only = "Apache attack helicopter")
Error in fct_drop(.,`What is your gender?`,only = "Apache attack helicopter") :
unused argument (`What is your gender?`)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)