我想将我的数据从字符重新编码为数字。这是我失败的尝试:
library(car) # needed for recode
survey1$V16a = recode(survey1$V16, "'Very important'=1; 'Fairly important'=2; 'Not very important'=3; 'Not important at all'=4; 'Can't choose'=99;", as.numeric.result=TRUE)
这是我随后收到的错误消息
重新编码错误(survey1$V16, "'非常重要'=1; '相当重要'=2; '不是很重要'=3; '一点也不重要'=4; '不能选择'=99;" , :
在重新编码术语中:'无法选择'= 99消息:解析错误(文本= strsplit(术语,“=”)[[1]] [1])::1:7:意外符号1:“可以”吨