Re: [R] Help with plot of PCA analysis (new user to R)
I was thinking to create the plot manually? What do you think? Thanks On Mar 7, 5:37 pm, darkpollo darkpo...@gmail.com wrote: 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-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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.
Re: [R] Help with plot of PCA analysis (new user to R)
Hi If you wish to obtain a 3d plot i think you can use tha bpca library. To test if it works try a code similar to this (after installing bpca package): bp-bpca(pca,lambda.end=3) plot(bp,var.factor=3,rgl.use=T,obj.name=F) Regards Guido 2012/3/8 darkpollo darkpo...@gmail.com I was thinking to create the plot manually? What do you think? Thanks On Mar 7, 5:37 pm, darkpollo darkpo...@gmail.com wrote: 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-h...@r-project.org mailing listhttps:// stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp:// www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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. -- Guido Leoni National Research Institute on Food and Nutrition (I.N.R.A.N.) via Ardeatina 546 00178 Rome Italy tel + 39 06 51 49 41 (operator) + 39 06 51 49 4498 (direct) [[alternative HTML version deleted]] __ 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.
[R] Help with plot of PCA analysis (new user to R)
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.