Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

[R] averaging within columns

thomas hills

2005-02-26

Replies:

I have a dataframe with names in the first column and wait times
between decisions in the second column. Since individuals make
multiple decisions, I want the average for each individual. For
example, the data might look like this

name  wtime
jo    1
jo    2
jo    1
jo    3
tim    3  
tim    2
tim    2
ro    1
ro    2
etc.

I'm hoping there is something like

mean(dataname$wtime[name])

which will just create a column with length equal to the number of
different names (levels) and an average wtime for each. So far though,
I haven't had much luck figuring that one out.

Thanks.
Thomas

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
©2008 r-help.com - Jax Systems, LLC, U.S.A.