view PCA.R @ 16:fe749b5b462e draft default tip

Uploaded
author mb2013
date Wed, 20 Nov 2013 07:20:16 -0500
parents dce35de9677e
children
line wrap: on
line source

# The tool PCA creates a principle component analysis on procrustes data.
# developer: M.Baak

#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)
#principle componten 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)