Hi,

I am having a question. With multiple observations for each ID, I would like
to keep only two or 3 observations for each ID. Does R have any command to
do this? thank you very much!
A simple example is below, How can I only keep the first 2 observations for
each j?
    j           x
1   1 0.795373270
2   1 0.326845207
3   1 0.049116967
4   1 0.673830996
5   2 0.411789618
6   2 0.628034020
7   2 0.413997203
8   2 0.704016624
9   3 0.135268136
10  3 0.597653294
11  3 0.682791760
12  3 0.127604737
13  4 0.624627821
14  4 0.558165210
15  4 0.010470284
16  4 0.420216783

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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