Re: [R] Matrix problems

2003-03-20 Thread Göran Broström
On Thu, 20 Mar 2003, Mmarques INESC wrote: Hi all. I do not know if it is a bug in the windows version but i have this problem. Reading a file with 20 rows, 2 columns and transforming into a 20 x 2 matrix. If I try to find an element by using the which command which gives some

RE: [R] Matrix problems

2003-03-20 Thread Adaikalavan Ramasamy
It 'unwraps' the 200,000 x 2 matrix into a vector with 400,000 elements and giving you the location/subscripts of this vector that matches the criterion. Instead you should use apply(mat1, 2, function(y) which( y == 2 )) which gives you the rows in each column that corresponds to 185.