Mercurial > repos > mb2013 > nepenthes_3dpca
changeset 7:5aaede6275f9 draft
Uploaded
author | mb2013 |
---|---|
date | Tue, 20 May 2014 03:26:37 -0400 |
parents | 7012f7336e61 |
children | 0cb68fb9010f |
files | PCA.R |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PCA.R Tue May 20 03:26:37 2014 -0400 @@ -0,0 +1,22 @@ +# The tool PCA creates a Principal Component Analysis on Procrustes coordinates. +# MB + +#commands of commandline +args <- commandArgs(TRUE) +#input file: procrustes coordinates +input <- args[1] +#output file +output <- args[2] +output2 <- args[3] + +#package geomorph +suppressMessages(library("geomorph")) + +#reading of coordinates +read <- read.csv(file <- input,header = TRUE) +#principal component analysis with princomp, using covariance matrix of coordinates +pca <- princomp(x=cov(read)) + +#output pca scores +write.csv(pca$scores,output, row.names = FALSE) +write.csv(pca$sdev, output2, row.names = FALSE)