Very cool. Thanks! 
-----Original Message-----
From: "Henrique Dallazuanna [via R]" 
<ml-node+2320470-1037864429-108...@n4.nabble.com>
To: Lipori, Gigi <pfl...@shands.ufl.edu>

Sent: 08/10/2010 05:18:25 PM
Subject: Re: Intersecting list vs rows in matrix




Try this:

 colSums(apply(List_2, 1, is.element, List_1))  > 0

On Tue, Aug 10, 2010 at 5:42 PM, GL <pfl...@shands.ufl.edu> wrote:

>
> Know that if I have List_1 and List_2 that I can check to see if the
> intersect via the code below:
>
> List _1:
> a, b, c, d, e, f, g
> List_2:
> z, y, x, w, v, u, b
> length(intersect(List_1, List_2)) > 0
> return = true
>
> If instead I wanted to check a dataframe that is a "list of lists," how
> would I do that by record without looping?
>
> List _1:
> a, b, c, d, e, f, g
>
> List_2:
> z, y, x, w, v, u, b
> y, z, w, v, v, u, m
> z, y, x, a, b, c
> .
> .
> .
>
> return
> true
> false
> true
> ,
> ,
> ,
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Intersecting-list-vs-rows-in-matrix-tp2320427p2320427.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________
View message @ 
http://r.789695.n4.nabble.com/Intersecting-list-vs-rows-in-matrix-tp2320427p2320470.html

To unsubscribe from Intersecting list vs rows in matrix, click 
http://r.789695.n4.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_code&node=2320427&code=cGZsdWdnQHNoYW5kcy51ZmwuZWR1fDIzMjA0Mjd8LTIwMDU4OTM4Nw==


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Intersecting-list-vs-rows-in-matrix-tp2320427p2320642.html
Sent from the R help mailing list archive at Nabble.com.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to