[R] Fwd: how to handle a longitudinal data

Douglas Bates bates at stat.wisc.edu
Sat Jan 27 16:04:38 CET 2007


On 1/27/07, gallon li <gallon.li at gmail.com> wrote:
> actually there are too many subjects.
>
> is there a way that i can make a table such that it can tell me the
> frequency of number of observations?
>
> Like
>
> 3 4 5
> ------------
> 30 40 60
>
> which means there are 30 subjects which each has 3 obs., 40 which each has 4
> obs.....

Yes, and Chuck has already given you the answer to that question.  See
below where he describes

table(table(df$id))


>
>
>  On 1/27/07, Chuck Cleland <ccleland at optonline.net> wrote:
> >
> > gallon li wrote:
> > > i have a data set with repeated measures on same people, structure like
> > > below:
> > >
> > > id x1 x2 ...
> > > 001 10 20 ...
> > > 001 8 45 ...
> > > 001 4 2 ...
> > > 002 ....
> > > 002 ...
> > > 002 ....
> > > 002 ....
> > > 003 ....
> > > .......
> > >
> > > what is the easist way to show how many observations for each subject
> > id?
> >
> > If the data are in a data frame called df, do the following:
> >
> > table(df$id)
> >
> > Also, the following is useful for seeing how many people have a
> > particular number of observations:
> >
> > table(table(df$id))
> >
> > >       [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> > --
> > Chuck Cleland, Ph.D.
> > NDRI, Inc.
> > 71 West 23rd Street, 8th floor
> > New York, NY 10010
> > tel: (212) 845-4495 (Tu, Th)
> > tel: (732) 512-0171 (M, W, F)
> > fax: (917) 438-0894
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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