That's great, thanks!

Jon



Gabor Grothendieck wrote:
> 
> Try this:
> 
> # test data
> DF <- data.frame(a = 1:9, a = 21:29, b = 31:39, b = 41:49, check.names =
> FALSE)
> 
> t(apply(DF, 1, tapply, names(DF), mean))
> 
> It gives a matrix so use as.data.frame on that if you need a data frame
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/averaging-pairs-of-columns-in-a-dataframe-tp19181319p19184350.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.

Reply via email to