7
|
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)
|