Hi, I am new to R and i am not sure if i am doing something wrong.
I have a table with 4500x24 (rowsxcols) elements. The rows are data related to each one of the individuals (A,B,C...) located on the columns. Example: A B C D E F 1 5.651296 5.480589 4.253070 3.515593 6.045253 5.916222 4.181060 2 9.402882 10.007563 9.838700 9.541653 9.968853 10.058527 9.988849 3 9.619392 10.358489 9.253168 10.295971 9.478020 9.574001 9.700798 4 12.727904 12.624954 12.945821 12.948913 12.703855 12.817992 12.909623 5 9.713688 10.057340 9.380006 9.722916 9.590145 9.237900 9.224427 6 11.329047 11.403621 12.555482 11.830408 11.479372 13.035209 14.550555 What i want to do is to make a PCA and plot the 3 principal components into a 3D graphic for each one of the individuals. This is what i am doing: data <- read.table("data.txt", header=TRUE) pca <- prcomp(data) summary(pca) this gives me 24 columns wiht PC1 to PC24 Now i want to plot only the PC1, PC2 and PC3 rp.plot3d(pca[,1],pca[,2],pca[,3]) this give an error "incorrect number of dimensions" If i make this instead: pca.sam <- pca$x rp.plot3d(pca.sam[,1],pca.sam[,2],pca.sam[,3]) It works, but it shows 4500 points and i only want the 24 points related to my columns. Any idea how to do this? Thanks Thanks ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.