[R] how to do sthg like "mat[!=(ind),]"

From: Florence Combes <fcombes_at_gmail.com>
Date: Thu 15 Sep 2005 - 22:45:33 EST


Hi

I want to do something which seems straightforward, but I couldn't find the way to do this.
I have a matrix called m for example, and a vector of values (let's call ind this vector) which are indices of lines I don't want to keep.

for example I have:

> m
v1 v2 v3
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
[4,] 10 11 12

> ind
[1] 2 4

I would like to obtain this:

> m2
v1 v2 v3
[1,] 1 4 7
[3,] 3 6 9

by saying something like

m2<-m[!=(ind),]

but this line does not work.

Any idea or suggestion highly welcome !

Florence.

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Sep 21 02:06:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:12 EST