[R] averaging within columns
BXC (Bendix Carstensen)
bxc at steno.dk
Sat Feb 26 18:19:47 CET 2005
?tapply
Bendix Carstensen
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of thomas hills
> Sent: Saturday, February 26, 2005 6:17 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] averaging within columns
>
>
> 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 at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read
> the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list