[R] average two sets of columns

From: Yuan Jian <jayuan2008_at_yahoo.com>
Date: Sun, 06 Jun 2010 21:53:05 -0700 (PDT)


Hi R experts.

how can I average two sets of columns?

dd <- data.frame(b = c("chr2", "chr1", "chrY", "chr13", "chrX"),         w=11:15, x = 1:5, y = c(8, 3, 9, 9,7),        z = c(1, 1, 1, 2, 8))
expected result for mean(w,x) and mean(y,z) is

1  chr2 6  4.5
2  chr1 7  2
3  chrY 8  5

4 chr13 9  5.5
5  chrX 10 7.5

Yu

      
	[[alternative HTML version deleted]]


______________________________________________

R-help_at_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. Received on Mon 07 Jun 2010 - 08:30:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 07 Jun 2010 - 09:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive