我有一个数据矩阵(900 列和 5000 行),我想对其进行 pca ..
该矩阵在 excel 中看起来非常好(意味着所有值都是定量的),但是在我在 R 中读取我的文件并尝试运行 pca 代码后,我收到一条错误消息,提示“以下变量不是定量的”,我得到了非定量变量列表。
所以一般来说,有些变量是定量的,有些不是。请参见以下示例。当我检查变量 1 时,它是正确且定量的..(随机一些变量在文件中是定量的)当我检查变量 2 时,它是不正确且非定量的..(随机一些像这样的变量是非定量的在文件中)
> data$variable1[1:5]
[1] -0.7617504 -0.9740939 -0.5089303 -0.1032487 -0.1245882
> data$variable2[1:5]
[1] -0.183546332959017 -0.179283451229594 -0.191165669598284 -0.187060515423038
[5] -0.184409474669824
731 Levels: -0.001841783473108 -0.001855956210119 ... -1,97E+05
所以我的问题是,我怎样才能把所有的非定量变量变成定量的?
使文件简短无济于事,因为这些值本身就是量化的。我不知道发生了什么。所以这是我的原始文件的链接 <- https://docs.google.com/file/d/0BzP-YLnUNCdwakc4dnhYdEpudjQ/edit
我也尝试了下面给出的答案,但它仍然没有帮助。
所以让我展示一下我到底做了什么,
> data <- read.delim("file.txt", header=T)
> res.pca = PCA(data, quali.sup=1, graph=T)
Error in PCA(data, quali.sup = 1, graph = T) :
The following variables are not quantitative: batch
The following variables are not quantitative: target79
The following variables are not quantitative: target148
The following variables are not quantitative: target151
The following variables are not quantitative: target217
The following variables are not quantitative: target266
The following variables are not quantitative: target515
The following variables are not quantitative: target530
The following variables are not quantitative: target587
The following variables are not quantitative: target620
The following variables are not quantitative: target730
The following variables are not quantitative: target739
The following variables are not quantitative: target801
The following variables are not quantitative: target803
The following variables are not quantitative: target809
The following variables are not quantitative: target819
The following variables are not quantitative: target868
The following variables a
In addition: There were 50 or more warnings (use warnings() to see the first 50)