Hi All,
I seem to be having a few troubles with aggregating data back onto the the
dataframe,
I want to take the max value of a user, and then apply this max value back
against all id's that match (i.e a one to many matching)
Can anyone offer any advice?  is there a better way of doing this?
Dummy data and code are listed below:-

dataset is called Mcookie

user_id        c_we_conversion
    1                     1
    1                     0
    1                     0
    2                     1
    2                     1
    3                     0
    3                     0

new data

user_id        c_we_conversion    c_we_conversion
    1                     1                          1
    1                     0                          1
    1                     0                          1
    2                     1                          1
    2                     1                          1
    3                     0                          0
    3                     0                          0

library(Hmisc)
myAgg<-summarize(Mcookie$c_we_conversion, by=Mcookie$user_id, FUN=max,
na.rm=TRUE)
names(myAgg)<- c("user_id","c_we_converter")
Mcookie <- merge(Mcookie, myAgg, by.x = "user_id", by.y = "user_id")


Thanks in advance,

Mike

	[[alternative HTML version deleted]]

