https://www.biostars.org/p/82583/
Key script from this is:
pvals=apply(d,1,function(x) {t.test(x[1:2],x[3:5])$p.value})
and here:
http://statistics.berkeley.edu/computing/r-t-tests
> names(ttest) [1] "statistic" "parameter" "p.value" "conf.int" "estimate" [6] "null.value" "alternative" "method" "data.name"