[R] matrix indexing
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.be
Wed Mar 15 17:06:56 CET 2006
matA[matB] or matA[!matB]
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "tom wright" <tom at maladmin.com>
To: "R-Stat Help" <R-help at stat.math.ethz.ch>
Sent: Wednesday, March 15, 2006 12:03 PM
Subject: [R] matrix indexing
> 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
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list