我试图将我的分类变量转换为数字(我想用数字替换这些单词,而不是一个一个地指定它们并指定它们应该具有的数字):
abaz
[1] " Crime" " Animation" " Drama" " Comedy" " Adventure"
[6] " Biography" " Documentary" "character(0)" " Thriller" " Fantasy"
[11] " Action"
> apply(abaz, 1, function(x) match(x, letters))
我收到此错误:
Error in apply(abaz, 1, function(x) match(x, letters)) :
dim(X) must have a positive length