[R] intersect of list elements

2006-07-21 Thread Georg Otto
Hi, i have a list of several vectors, for example: vectorlist $vector.a.1 [1] a b c $vector.a.2 [1] a b d $vector.b.1 [1] e f g I can use intersect to find elements that appear in $vector.a.1 and $vector.a.2: intersect(vectorlist[[1]], vectorlist[[2]]) [1] a b I would like to use grep

Re: [R] intersect of list elements

2006-07-21 Thread Berton Gunter
Subject: [R] intersect of list elements Hi, i have a list of several vectors, for example: vectorlist $vector.a.1 [1] a b c $vector.a.2 [1] a b d $vector.b.1 [1] e f g I can use intersect to find elements that appear in $vector.a.1 and $vector.a.2: intersect

Re: [R] intersect of list elements

2006-07-21 Thread Sundar Dorai-Raj
Georg Otto wrote: Hi, i have a list of several vectors, for example: vectorlist $vector.a.1 [1] a b c $vector.a.2 [1] a b d $vector.b.1 [1] e f g I can use intersect to find elements that appear in $vector.a.1 and $vector.a.2: intersect(vectorlist[[1]],

Re: [R] intersect of list elements

2006-07-21 Thread Gabor Grothendieck
The following assumes that within each component of vectorlist the vector elements are unique. In that case the first two lines define vectorlist and perform the grep, as in your post. Elements of the intersection must occur n times where n is the number of components of vectorlist that match the