[R] manipulating longitudinal data in r
Michael Dewey
info at aghmed.fsnet.co.uk
Mon Nov 19 17:52:58 CET 2012
At 17:13 18/11/2012, Jeff Newmiller wrote:
>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.
It does now but we do not know whether that was how it started life.
My remarks were intended as a general comment, not necessarily a
solution to the OP's specific problem.
>---------------------------------------------------------------------------
>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.
Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html
More information about the R-help
mailing list