[R] adding aggregate data to data frames
dieter_vanderelst at emailengine.org
Fri Oct 19 16:14:27 CEST 2007
I have a data frame containing reaction times of participants in some experiment.
As usual each line is single trial in the experiment. Two factors denote the conditions in the experiment. Each participant completes different trials for each condition.
Now, the question:
I want to calculate per participant, per condition the mean reaction time and its standard deviation.
I can do this using AGGREGATE(). However, I want to merge this info with the original data frame. This is, I want each line to contain the mean and SD of the reaction time for the participant and condition on that line.
I have tried to solve this by looping trough data frame. For each line, I select using SUBSET() the lines that belong to the same participant and condition. Then I calculate the average/SD. But this takes a long time.
BYTW: I find that finding proper subject for r-help list mails, is very hard. So, if any one knows a set of better keywords...
dieter _ vanderelst AT emailengine DOT org
d DOT vanderelst AT tue DOT nl
Eindhoven University of Technology
Faculty of Industrial Design
Designed Intelligence Group
Den Dolech 2
5612 AZ Eindhoven
Tel +31 40 247 91 11
More information about the R-help