Re: [R] Select the same rows

2009-04-30 Thread sangduan J.
thanks Seangduan sangduan J. wrote: > > > Hi all, > I have a problem selecting some rows from a random data. > I'd like to select the same rows (before 0) . > > For example: > A > > [1] 0 > [2] 1 > [3] 2 > [4] 0 > [5] 1 > [6] 0 > [7] 1 > [8] 2 > [9] 3 > [10] 4 > > I'd

Re: [R] Select the same rows

2009-04-28 Thread David Winsemius
It is unclear what you really want so here are two solutions to two different questions: > A <- matrix(c(0,1,2,0,1,0,1,2,3,4), ncol=1) > A [,1] [1,]0 [2,]1 [3,]2 [4,]0 [5,]1 [6,]0 [7,]1 [8,]2 [9,]3 [10,]4 > A[A[,1] %in% c(2,1,4) , ] [1] 1

[R] Select the same rows

2009-04-28 Thread sangduan jansomboon
Hi all, I have a problem selecting some rows from a random data. I'd like to select the same rows (before 0) . For example: A [1] 0 [2] 1 [3] 2 [4] 0 [5] 1 [6] 0 [7] 1 [8] 2 [9] 3 [10] 4 I'd like to select the row where a = 2 1 4 I searched on the search of the R site b