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]]

