match_list: Match list elements to another list

match_listR Documentation

Match list elements to another list

Description

Match list elements to another list

Usage

match_list(x, y, ...)

Arguments

x, y

list objects to be compared

...

additional arguments are ignored.

Details

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.

Value

integer vector with the same length as x. The integer values give the position in y of the first match.

See Also

Other venndir utility: curate_venn_labels(), expand_range(), make_color_contrast(), make_venn_combn_df(), make_venn_test(), nudge_venndir_label(), print_color_df(), shrink_df(), three_point_angle(), venndir_legender(), venndir_to_df()

Examples

x <- list(a=LETTERS[1],
   b=LETTERS[1:2],
   c=LETTERS[2:4]);
x;
y <- list(
   d=LETTERS[1:2],
   e=LETTERS[2],
   f=LETTERS[2:4]);
y;
match_list(x, y)
match_list(y, x)


jmw86069/venndir documentation built on Nov. 14, 2024, 10:12 a.m.