###Principal Component Analysis for both species #EMA package in R Both<-read.csv(file.choose(),header=TRUE,row.names=1) #NOTE: Use SCALE=TRUE if the variables are not measured in the same units. If they are not in the same units scaling allows the variables to have the same influence to each other. Both_PCA<-runPCA(Both, scale=FALSE, pdfname="Both_PCA.pdf") #The pdf file will contain scree plot and the first 3 PCs #To get the graph with the PC components plotSample(Both_PCA, axes=c(1,2)) #To get a summary of the file summary(Both_PCA) Both_PCA_eig_out<-Both_PCA$eig Both_PCA_correlations_out<-Both_PCA$var$cor Both_PCA_coor_out<-Both_PCA$ind$coor write.table(Both_PCA_correlations_out, file="Both_PCA_correlations", append=FALSE, row.names=TRUE, col.names=TRUE) write.table(Both_PCA_eig_out, file="Both_PCA_eigen_values", append=FALSE, row.names=TRUE, col.names=TRUE) write.table(Both_PCA_coor_out, file="Both_PCA_coordinates", append=FALSE, row.names=TRUE, col.names=TRUE)