[EMAIL PROTECTED]

>> y <- matrix(1:8, ncol=2)
>> is.matrix(y[-c(1,2),])
>[1] TRUE
>> is.matrix(y[-c(1,2,3),])
>[1] FALSE
>> is.matrix(y[-c(1,2,3,4),])
>[1] TRUE

>It seems like an inconsistent behaviour:
>- with 2 or more rows we have a matrix
>- with 1 row we do not have a matrix and
>- with 0 rows we have a matrix again

?'[' explains it.  Using your example:

> is.matrix(y[-c(1, 2), , drop=FALSE])
[1] TRUE

> is.matrix(y[-c(1, 2, 3), , drop=FALSE])
[1] TRUE

> is.matrix(y[-c(1, 2, 3, 4), , drop=FALSE])
[1] TRUE

-- 
François Pinard   http://pinard.progiciels-bpi.ca

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to