[R] how to calculate "conditional" mean?

Terry Mu muster at gmail.com
Sun Dec 5 17:06:17 CET 2004

a data set like this:

year   month    day    count
2001     1            1         10
2001     1            2          11
2004     7            17        8

basically it is a count of of some numbers everyday through a few years

now I'd like to get the mean of the count for every day. 

I thought I can do this using for and ifelse,
but is there a simple way to do this? I wish a function like 
mean(count, 'only when year, month, day are equal') could do this.

thank you.

More information about the R-help mailing list