comparison PCA.R @ 7:5aaede6275f9 draft

Uploaded
author mb2013
date Tue, 20 May 2014 03:26:37 -0400
parents
children
comparison
equal deleted inserted replaced
6:7012f7336e61 7:5aaede6275f9
1 # The tool PCA creates a Principal Component Analysis on Procrustes coordinates.
2 # MB
3
4 #commands of commandline
5 args <- commandArgs(TRUE)
6 #input file: procrustes coordinates
7 input <- args[1]
8 #output file
9 output <- args[2]
10 output2 <- args[3]
11
12 #package geomorph
13 suppressMessages(library("geomorph"))
14
15 #reading of coordinates
16 read <- read.csv(file <- input,header = TRUE)
17 #principal component analysis with princomp, using covariance matrix of coordinates
18 pca <- princomp(x=cov(read))
19
20 #output pca scores
21 write.csv(pca$scores,output, row.names = FALSE)
22 write.csv(pca$sdev, output2, row.names = FALSE)