[R] manipulating longitudinal data in r
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Sun Nov 18 18:13:05 CET 2012
Michael, this comment doesn't seem appropriate to the question, since the sample data is a ragged array that requires the addition of NAs to fit into a wide format.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Michael Dewey <info at aghmed.fsnet.co.uk> wrote:
>At 08:56 17/11/2012, Kemi Racheal wrote:
>>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.
>
>Dear Kemi
>It is often easier to do some sorts of manipulations on the wide
>format of the data. I appreciate that you can always do it both ways.
>
>
>>Oluwakemi
>>
>>
>> [[alternative HTML version deleted]]
>
>Michael Dewey
>info at aghmed.fsnet.co.uk
>http://www.aghmed.fsnet.co.uk/home.html
>
>______________________________________________
>R-help at 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.
More information about the R-help
mailing list