Dear list member,

I have the following data example
ke <- data.frame(patid=c(1,1,1,2,3,3),a=c(1,2,2,1,1,2))

I want to add another variable b, such that the max of 'a' by id is returned
i.e data ke becomes
ke <- data.frame(patid=c(1,1,1,2,3,3),a=c(1,2,2,1,1,2),b=c(2,2,2,1,2,2))

Any help will be appreciated.

Oluwakemi


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to