Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

complement_element

Complement of elements


Description

Return the objects without the elements listed

Usage

complement_element(object, elements, ...)

## S4 method for signature 'TidySet,characterORfactor'
complement_element(
  object,
  elements,
  name = NULL,
  FUN = NULL,
  keep = TRUE,
  keep_relations = keep,
  keep_elements = keep,
  keep_sets = keep
)

Arguments

object

A TidySet object.

elements

The set to look for the complement.

...

Placeholder for other arguments that could be passed to the method. Currently not used.

name

Name of the new set. By default it adds a "C".

FUN

A function to be applied when performing the union. The standard union is the "max" function, but you can provide any other function that given a numeric vector returns a single number.

keep

Logical value to keep all the other sets.

keep_relations

A logical value if you wan to keep old relations.

keep_elements

A logical value if you wan to keep old elements.

keep_sets

A logical value if you wan to keep old sets.

Value

A TidySet object.

Methods (by class)

  • object = TidySet,elements = characterORfactor: Complement of the elements.

See Also

Other complements: complement_set(), complement(), subtract()

Other methods that create new sets: complement_set(), intersection(), subtract(), union()

Examples

relations <- data.frame(
    sets = c("A", "A", "B", "B", "C", "C"),
    elements = letters[seq_len(6)],
    fuzzy = runif(6)
)
TS <- tidySet(relations)
complement_element(TS, "a", "C_a")
complement_element(TS, "a", "C_a", keep = FALSE)

BaseSet

Working with Sets the Tidy Way

v0.0.16
MIT + file LICENSE
Authors
Lluís Revilla Sancho [aut, cre] (<https://orcid.org/0000-0001-9747-2570>), Zebulun Arendsee [rev], Jennifer Chang [rev]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.