set_comp: Set Comparison

Description Usage Arguments Value Examples

View source: R/Compare_Sets.R

Description

Compare two sets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set_comp(set1, set2, compNames = FALSE)

## S3 method for class 'set_comp'
print(
  x,
  ...,
  indent = 4,
  color = "#CCCCCC",
  printSets = FALSE,
  printInt = TRUE,
  printUnion = FALSE,
  printDiffs = TRUE
)

Arguments

set1

The first set to compare.

set2

The second set to compare.

compNames

Whether to compare the names of the sets, or the sets themselves (logical scalar).

x

A set_comp object.

...

Additional arguments passed to the print function (not used).

indent

The indent argument to pass to the KO::vec_print function.

color

The color argument to pass to the KO::vec_print function.

printSets

Whether to print the original sets (logical scalar).

printInt

Whether to print the intersection of the sets (logical scalar).

printUnion

Whether to print the union of the sets (logical scalar).

printDiffs

Whether to print the differences (logical scalar).

Value

A two-element list of the set differences.

The input, invisibly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set_comp(1:10, 6:15)
set_comp(mtcars[, -1], mtcars[, -2])
set_comp(c(a = 1, b = 2, c = 3), c(a = 1, b = 2, d = 4))
set_comp(c(a = 1, b = 2, c = 3), c(a = 1, b = 2, d = 4), compNames = FALSE)
set_comp(c(a = 1, b = 2, c = 3), c(a = 1, b = 2, d = 4), compNames = TRUE)
comp <- set_comp(c(a = 1, b = 2, c = 3), c(a = 1, b = 2, d = 4))

set_comp(1:10, 6:15)
print(set_comp(1:10, 6:15))
print(set_comp(1:10, 6:15), indent = 2, color = "#FFFF00")
print(set_comp(1:10, 6:15), printSets = TRUE, printInt = FALSE,
      printUnion = TRUE, printDiffs = FALSE)

KO112/KO documentation built on Oct. 2, 2020, 9:21 a.m.