Repository 'nepenthes_3dpca'
hg clone https://toolshed.g2.bx.psu.edu/repos/mb2013/nepenthes_3dpca

Changeset 7:5aaede6275f9 (2014-05-20)
Previous changeset 6:7012f7336e61 (2014-05-20) Next changeset 8:0cb68fb9010f (2014-05-20)
Commit message:
Uploaded
added:
PCA.R
b
diff -r 7012f7336e61 -r 5aaede6275f9 PCA.R
--- /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)