This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Do an R-mode using prcomp(), for correlation and covariance among variables | |
#for Q-mode PCA :the data set should be transposed before procceeding | |
#Q-mode focuses on correlations and covariance among samples | |
mydata<-read.table(file="/Users/WenhuiZhang/Desktop/hypeScpec_R/R_hyperspectra/mydata.txt",header=TRUE,row.name=1,sep=",") | |
mydata.pca<-prcomp(mydata,retx=TRUE,center=TRUE,scale.=TRUE) | |
#variable means set to zero, and variance set to one sample scores stored in mydata.pca$x |