我正在尝试绘制带有热编码DNA数据的pca图。 数据以
的形式存储在数据帧(all_coded)中+ ---------------------------------------------- -------------------------------------------------- -------------- + | V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,V20 |
+ ---------------------------------------------- -------------------------------------------------- -------------- + | 0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1, 0,1,0,0,1,0,0,0,1,0,0,0 || 1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1, 0,0,0,1,0,1,0,0,0,0,1,0 || 0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0, 1,0,0,0,0,0,0,1,0,0,0,1 || 0,0,0,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0, 0,0,1,0,0,0,1,0,1,0,0,1 || 0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0, 0,1,0,1,0,0,1,0,0,0,1,0 || 0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,0, 0,1,0,0,0,0,0,0,1,0,0,0 |
+ ---------------------------------------------- -------------------------------------------------- --------------- +
使用的编码如下:
Sample.scaled.2 <- data.frame(t(na.omit(t(all_coded[ , c(1:400)]))))
pca.Sample.2 <- prcomp(Sample.scaled.2, retx=FALSE)
#----------
# Plot PCA results
autoplot(pca.Sample.2, data = all_coded, colour = 'bound_status', alpha = 0.2)
与其绘制图表,不如抛出错误:
Error in model$x %*% t(model$rotation) : requires numeric/complex matrix/vector arguments