【发布时间】:2020-11-13 22:29:22
【问题描述】:
我试图重新编码一项复杂调查数据集的一个变量。 我试过 dplyr::recode 函数。
occup<-recode(sv$v717, c(0 )='0'; c(1, 2, 3 )='1'; c(4 )='2'; c(8, 9 )='3'; c(96, 98)='98'")
之前我也以同样的方式成功。 但是,这次我收到如下错误
Error in UseMethod("recode") : no applicable method for 'recode' applied to an object of class "c('haven_labelled', 'vctrs_vctr', 'double')"
如何修复此错误或如何重新编码变量?
【问题讨论】: