我有一个平方关系矩阵,使用:
config/session.php
矩阵如下:
data<-input[,!names(input) %in% "gene"]
data1<-t(as.matrix(data[-1])) %*% as.matrix(data[-1]) / ncol(data)
我要绘制此矩阵的PCA图。我尝试使用:
Sample1 Sample2 Sample3 Sample4
Sample1 9418618.2 13053118.21 10547526.06 13866574.6
Sample2 13053118.21 35073099.45 26735255.06 24575542.03
Sample3 10547526.06 26735255.06 23083477.94 19077039.18
Sample4 13866574.6 24575542.03 19077039.18 25187674.69
Sample5 9443282.04 23464046.78 26729979.61 12996476.38
但是它给出了错误:
res.pca <- prcomp(data, scale = TRUE)
summary(res.pca)
str(res.pca)
plot(res.pca$x[,1],res.pca$x[,2], xlab="PC1", ylab = "PC2", main = "PC1 / PC2 - plot11")