Just as an update on this problem: I have managed to get the variance for the selected columns
Now all I need is the covariance between these 2 selections - the two target columns are and the aim is that a new column contain a covariance value between these on each row: maindata[,c(174:213)] and maindata[,c(214:253] I've played around with all sorts of apply (and derivatives of apply) and in various different setups so I think I'm close but I feel like I'm chasing my tail here! -- View this message in context: http://r.789695.n4.nabble.com/correlations-between-columns-for-each-row-tp4039193p4073208.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.