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
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
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]],
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