btw, if you just wanted your exact code to work: t(as.matrix(aggregate(t(as.matrix(DF)),list(rep(1:1,each=2)),mean, na.rm=TRUE)[,-1]))
You will get NaNs rather than NAs where you are missing from both rows, but that should not be a real issue. <snip> -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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.