Re: [R] Fwd: how to handle a longitudinal data

From: Douglas Bates <bates_at_stat.wisc.edu>
Date: Sat 27 Jan 2007 - 15:04:38 GMT

On 1/27/07, gallon li <gallon.li@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@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@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@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.
>



R-help@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. Received on Sun Jan 28 02:10:21 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 27 Jan 2007 - 15:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.