Re: [R] help on data selection

2008-06-09 Thread jim holtman
This should do it for you: > x <- read.table(textConnection(" 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

[R] help on data selection

2008-06-09 Thread Lisa
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.79