Ghosh Mini wrote:

Dear all,


I am trying to learn R.
Is it possible to find the mean of some rows (of some table) and to put it
in new table.

For example we have following table

         date      x      y      z
1  05-23-2001      7      1      3
2  05-24-2001      8      4      5
3  05-24-2001      6      0      0
4  05-24-2001     26      2      6
5  06-19-2001      0      7      0
6  06-19-2001      5      0      2


and I want to make the table


         date      x      y      z
1  05-23-2001
2  05-24-2001      (mean values for each day's)
6  06-19-2001

Is it possible to do this using R???

If possible pl. help me. Thanking you.



Let `dframe' contain your first table. Then use aggregate:


aggregate(dframe[, c("x", "y", "z")], list(date = dframe$date), mean)

HTH,

Sundar

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to