i have a large longitudinal data set. The number of observations for each
subject is not the same across the sample. The largest number of a subject
is 5 and the smallest number is 1.

now i want to make each subject to have the same number of observations by
filling zero, e.g., my original sample is

id x
001 10
001 30
001 20
002 10
002 20
002 40
002 80
002 70
003 20
003 40
004 ......

now i wish to make the data like

 id x
001 10
001 30
001 20
001 0
001 0
002 10
002 20
002 40
002 80
002 70
003 20
003 40
003 0
003 0
003 0
004 ......

so that each id has exactly 5 observations. is there a function which can
allow me do this quickly?

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

Reply via email to