CorrelationR.sh 562 Bytes
Newer Older
Pramod R Sanaga's avatar
Pramod R Sanaga committed
1
#!/bin/sh
2 3 4 5 6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2007 University of Utah and the Flux Group.
# All rights reserved.
#
Pramod R Sanaga's avatar
Pramod R Sanaga committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

InputFile1="\"$1\""
InputFile2="\"$2\""
OutputFile="\"$3\""

/proj/tbres/R/bin/R --slave  << EOF

xv <- read.table($InputFile1, header=0)
yv <- read.table($InputFile2, header=0)

xval <- xv[,2]
yval <- yv[,2]

corrObj <- ccf(xval, yval, lag.max=1000, type="correlation", plot=FALSE)
dataFrame <- data.frame(corrObj[[4]], corrObj[[1]])
write.table(dataFrame,file=$OutputFile,quote=FALSE,row.names=FALSE, col.names=FALSE)

q(runLast=FALSE)

EOF