#!/bin/bash

# regularity,variability,improvement,"Evolution error",steps
# 6.57581e-05,0.00592209,0.622392,113.016,2368

if [[ -f "$2" ]]; then

R -q --slave --vanilla <<EOF
print("================ Analyzing $2")
#library(Hmisc)
DF=as.matrix(read.csv("$2",header=TRUE))
print("Mean:")
mean(DF[,$1])
print("Median:")
median(DF[,$1])
print("Sigma:")
sd(DF[,$1])
print("Range:")
range(DF[,$1])
EOF

else

echo "Usage: $0 <column> <Filename.csv>"
fi

