Skip to contents

Use complement to find elements or sets the TidySet object. You can use activate with complement or use the specific function. You must specify if you want the complements of sets or elements.

Usage

complement(.data, ...)

Arguments

.data

The TidySet object

...

Other arguments passed to either complement_set() or complement_element().

Value

A TidySet object

Examples

rel <- data.frame(
    sets = c("A", "A", "B", "B", "C", "C"),
    elements = letters[seq_len(6)],
    fuzzy = runif(6)
)
TS <- tidySet(rel)
TS %>%
    activate("elements") %>%
    complement("a")
#>   elements sets      fuzzy
#> 1        a    A 0.53157354
#> 2        b    A 0.49363702
#> 3        c    B 0.77930863
#> 4        d    B 0.20417834
#> 5        e    C 0.71339728
#> 6        f    C 0.06521611
#> 7        a   ∁a 0.46842646
TS %>%
    activate("elements") %>%
    complement("a", "C_a", keep = FALSE)
#>   elements sets     fuzzy
#> 1        a  C_a 0.4684265
TS %>%
    activate("set") %>%
    complement("A")
#>   elements sets      fuzzy
#> 1        a    A 0.53157354
#> 2        b    A 0.49363702
#> 3        c    B 0.77930863
#> 4        d    B 0.20417834
#> 5        e    C 0.71339728
#> 6        f    C 0.06521611
#> 7        a   ∁A 0.46842646
#> 8        b   ∁A 0.50636298
TS %>%
    activate("set") %>%
    complement("A", keep = FALSE)
#>   elements sets     fuzzy
#> 1        a   ∁A 0.4684265
#> 2        b   ∁A 0.5063630
TS %>%
    activate("set") %>%
    complement("A", FUN = function(x){abs(x - 0.2)}, keep = FALSE)
#>   elements sets     fuzzy
#> 1        a   ∁A 0.3315735
#> 2        b   ∁A 0.2936370