[R] combining elements in a data frame

Lee Averell Lee.Averell at newcastle.edu.au
Fri Jul 15 06:17:17 CEST 2011


Hi all,
        I have 2 data frames the first contains a list with repeats of words and an associated response time (RT) measure for each word. The second is a tabulation of each unique word and other information such as the amount and of responses for each word. I need to determine the mean RT for each word and add that as a column in the second data frame. 
Any help would be appreciated
Cheers
Lee

Data frame 1

> head(alldat)
     s expt session cycle trial left.right freq concr    word   rt resp Response correct corrResp
121 1a    a       1    C1     1          1   lf    hc pianist 1529  old       hi   FALSE      new
122 1a    a       1    C1     2          1   hf    hc   sweat 1518  new       hi    TRUE      new
123 1a    a       1    C1     3          1   lf    lc carnage 1046  old       hi    TRUE      old
124 1a    a       1    C1     4          1   lf    hc   nymph 1142  old       hi    TRUE      old
125 1a    a       1    C1     5          1   hf    lc    hank 1487  new       hi    TRUE      new
126 1a    a       1    C1     6          1   lf    hc   waist 1199  new       hi    TRUE      new
    respType
121        s
122        s
123        s
124        s
125        s
126        s
> 

Data frame 2

> head(CCCW)
        FALSE TRUE    CC    propCC lo hi
abode       2   11  TRUE 0.8461538  4  9
abyss       1   12  TRUE 0.9230769  2 11
accord      2   11  TRUE 0.8461538  2 11
account     0    0 FALSE       NaN  0  0
acre        4    9  TRUE 0.6923077  4  9
adage       0    0 FALSE       NaN  0  0



More information about the R-help mailing list