Re: [R] Intersecting list vs rows in matrix

2010-08-10 Thread GL
Very cool. Thanks! -Original Message- From: "Henrique Dallazuanna [via R]" To: Lipori, Gigi 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 wrote: >

Re: [R] Intersecting list vs rows in matrix

2010-08-10 Thread Henrique Dallazuanna
Try this: colSums(apply(List_2, 1, is.element, List_1)) > 0 On Tue, Aug 10, 2010 at 5:42 PM, GL 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

Re: [R] Intersecting list vs rows in matrix

2010-08-10 Thread Wu Gong
Hi GL, Erik has given a data.frame solution. If you data is a list with unequal lengths, try lapply. - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Intersecting-list-vs-rows-in-matrix-tp2320427p2320463.html Sent from the R help mailing list archive at Nabble.

Re: [R] Intersecting list vs rows in matrix

2010-08-10 Thread Erik Iverson
GL 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," ho

[R] Intersecting list vs rows in matrix

2010-08-10 Thread GL
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 t