Convenience function comparing three elements using a desired comparator function.

compare_three(
  x,
  y,
  z,
  compare_fun = "identical",
  result = c("single", "itemized")
)

Arguments

x, y, z

Vectors of equal length to compare

compare_fun

A function used to compare defaults to identical.

result

For single it will return logical scalar TRUE if all arguments are identical; for itemized it will return vector of length equal to lengths of passed arguments. Defaults to single.

Value

A logical vector of length equal to a, b, c

Details

The results of the comparator function are tested with

Examples

compare_three(1:10, 1:10, 1:10)
#> [1] TRUE
compare_three(c("b", "a"), c("b", "b"), c("b", "c"), result = "itemized")
#> [1] TRUE FALSE