[问题] factor问题

楼主: ademon (SANDY)   2017-10-09 00:53:03
[问题类型]:
套件更新
[软件熟悉度]:
入门(写过其他程式,只是对语法不熟悉)
[问题叙述]:
想用factor把a,b,c类别转换成h,h,j两种类别 但年初可以用的,现在却出现
factor level [2] is duplicated 的错误代码
也就是说一定要一对一,h,k,j就不会有错误了...
[程式范例]:
> x <- c(letters[1:3], letters[1:3])
> factor(x, levels = c("a", "b", "c"), labels = c("h", "h", "j"))
[环境叙述]:
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
[关键字”:
factor
作者: abc2090614 (casperxdd)   2017-10-09 04:52:00
x = factor(x); levels(x) <- c("h", "k", "k")R version 3.4.2

Links booklink

Contact Us: admin [ a t ] ucptt.com