Re: [R] how to handle a longitudinal data

From: Chuck Cleland <ccleland_at_optonline.net>
Date: Sat 27 Jan 2007 - 10:07:04 GMT

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

______________________________________________
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 Sat Jan 27 21:11:46 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 - 10:30:30 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.