Hi everybody,

I would like to compute the mean for 1 variable between the rows with the same levels.

For example, with the dataset below:
Factor1      Factor2      Value
A               X               1
A               X               2
A               Y               3
A               Y               4
B               X               5
B               X               6
B               Y               7
B               Y               8

I would like to get:
Factor1      Factor2      Value
A               X               1.5
A               Y               3.5
B               X               5.5
B               Y               7.5

Up to now, I worked in Statistica and Systat, and it was called "column statistics" in Statistica (and I had a script with the "BY" function in Systat).

Of course it is a simplified case. For my dataset I have 4 factors and 15 variables, so a general method would be nice. However, my skills are not that great, so if you could please give some explanations (I mean other than what is in the ?function of course).

Thanks a lot in advance
Ivan

______________________________________________
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