Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
10 times the basics...) ;-) O. -Message d'origine- De : Sarah Goslee [mailto:sarah.gos...@gmail.com] Envoyé : jeudi 13 mars 2014 16:59 À : Olivier ETERRADOSSI Cc : r-help Objet : Re: [R] behaviour of rows and colomns suppression in a matrix On Thu, Mar 13, 2014 at 11:51 AM, Olivier ET

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
ector instead of NOT with a logical. Olivier -Message d'origine- De : arun [mailto:smartpink...@yahoo.com] Envoyé : jeudi 13 mars 2014 16:13 À : r-help@r-project.org Cc : Olivier ETERRADOSSI Objet : Re: [R] behaviour of rows and colomns suppression in a matrix Hi, You could use: TM2[!ma

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Sarah Goslee
On Thu, Mar 13, 2014 at 11:51 AM, Olivier ETERRADOSSI wrote: > Thank you Sarah, > > But no, I was not expecting this. For me integer(0) is not 0. > That's why I finally tested length(unused.rows), which is 0 when > unused.rows is integer(0). Also from ?"[" i, j, ...: indices specifying elements

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
14 16:12 À : Olivier ETERRADOSSI Cc : r-help Objet : Re: [R] behaviour of rows and colomns suppression in a matrix Hi, Your basic problem seems to be that you expect R to take TM2[0, ] as meaning not to subset anything, rather than to take only row 0, which doesn't exist: R> TM2[0,]

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread arun
Hi, You could use:  TM2[!margin.Rows <=thresh,!margin.Cols <=thresh] # [,1] [,2] #[1,]    1    1 #[2,]    1    1 #[3,]    1    1 #For the first case: TM1[!margin.Rows <=thresh,!margin.Cols <=thresh] # [,1] [,2] #[1,]    1    1 #[2,]    1    1 A.K. On Thursday, March 13, 2014 10:02

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Sarah Goslee
Hi, Your basic problem seems to be that you expect R to take TM2[0, ] as meaning not to subset anything, rather than to take only row 0, which doesn't exist: R> TM2[0,] [,1] [,2] [,3] There's a hint in ?"[" which says: An index value of 'NULL' is treated as if it were

[R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
Hi  List, while running a script on a set of matrices I came into a case I would not have guessed to arrive. Below is  a small toy example to illustrate the case. Of course there is a simple workaround (using a simple test), but why does this occur, and shouldn’t it be corrected ? More probably I