[R] matrix indexing

tom wright tom at maladmin.com
Wed Mar 15 14:03:33 CET 2006


Thanks everyone.
Obvious when you think about it, and you check that both the matrices
your trying it with are actually matrices... instead of one being a
list.

On Wed, 2006-15-03 at 06:03 -0500, tom wright wrote:
> Can someone please give me a pointer here.
> I have two matrices
> 
> matA
> 	A	B	C
> 1	5	2	4
> 2	2	4	3
> 3	1	2	4
> 
> matB
> 	A	B	C
> 1	TRUE	FALSE	TRUE
> 2	FALSE	TRUE	TRUE
> 3	FALSE	FALSE	FALSE
> 
> how do I extract all the values from matA where the coresponding entry
> in matB == TRUE (or FALSE), perferably in vector form.
> 
> Many thanks
> tom
> 
> ______________________________________________
> R-help at 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
>




More information about the R-help mailing list