[R] Excluding rows from a matrix

Peter Malewski y0004379 at tu-bs.de
Mon Aug 21 17:33:50 CEST 2000


On Mon, 21 Aug 2000, José Ernesto Jardim wrote:

> but I'm unable to (i) select the 3 rows at once, (ii) select the matrix
> excluding those rows.
> 
> How can I do it ?

> x <- matrix(1:10,,2)
> x
     [,1] [,2]
[1,]    1    6
[2,]    2    7
[3,]    3    8
[4,]    4    9
[5,]    5   10
> x[x[,1]%in%c(2,3),]
     [,1] [,2]
[1,]    2    7
[2,]    3    8
> x[!x[,1]%in%c(2,3),]
     [,1] [,2]
[1,]    1    6
[2,]    4    9
[3,]    5   10
> 


??P.

----

P.Malewski, Maschplatz 8, 38114 Braunschweig, Tel.: 0531 500965, 
At work: (MH-Hannover): 0511 532 3194 / Fax: 0511 532 3190, 
P.Malewski at tu-bs.de, peter.malewski at gmx.de, malewski.peter at mh-hannover.de.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list