Match list elements to another list
match_list(x, y, ...)
list
objects to be compared
additional arguments are ignored.
integer
vector
with the same length as x
. The
integer values give the position in y
of the first match.
This function takes two list
objects, and matches
the first list
elements to the second list
.
Each list contains list elements, for example if x
is a list
, then the element in position i
is accessed
using x[[i]]
.
A match between x[[i]]
and y[[j]]
is defined as follows:
all elements in x[[i]]
are contained in y[[j]]
all elements in y[[j]]
are contained in x[[i]]
For this function, item order and item duplication is ignored.
This function uses logic in the form all(x[[i]] %in% y[[j]])
,
so it will operate properly with input objects compatible
with that format. The function is intended to be used with
list
that contains atomic
vectors
.
Other venndir utility:
curate_venn_labels()
,
expand_range()
,
make_color_contrast()
,
make_venn_combn_df()
,
make_venn_test()
,
modify_venndir_overlap()
,
nudge_venndir_label()
,
plot,Venndir,ANY-method
,
print_color_df()
,
shrink_df()
,
three_point_angle()
,
venndir_legender()
,
venndir_to_df()
x <- list(a=LETTERS[1],
b=LETTERS[1:2],
c=LETTERS[2:4]);
x;
#> $a
#> [1] "A"
#>
#> $b
#> [1] "A" "B"
#>
#> $c
#> [1] "B" "C" "D"
#>
y <- list(
d=LETTERS[1:2],
e=LETTERS[2],
f=LETTERS[2:4]);
y;
#> $d
#> [1] "A" "B"
#>
#> $e
#> [1] "B"
#>
#> $f
#> [1] "B" "C" "D"
#>
match_list(x, y)
#> a b c
#> NA 1 3
match_list(y, x)
#> d e f
#> 2 NA 3