tr_compare_lists: Easily compare two lists

View source: R/tr_compare_lists.R

tr_compare_listsR Documentation

Easily compare two lists

Description

Performs intersect(x, y), setdiff(x, y), and setdiff(y, x). Returns these elements in a list with names "common", "unique_x", and "unique_y".

Usage

tr_compare_lists(x, y, names = NULL)

Arguments

x

First vector to compare.

y

Second vector to compare.

names

Optional character vector, containing names of x and y to apply to the output.

Value

A named list of the common and unique elements of x and y.

References

None.

See Also

https://www.github.com/travis-m-blimkie/tRavis

Examples

tr_compare_lists(
  x = c(1, 2, 4, 5, 6),
  y = c(2, 3, 6, 7),
  names = c("A", "B")
)


travis-m-blimkie/tRavis documentation built on April 9, 2024, 11:45 p.m.