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]] > > ______________________________________________ > [email protected] 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 ______________________________________________ [email protected] 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.
