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.
Arguments
- .data
The TidySet object
- ...
Other arguments passed to either
complement_set()
orcomplement_element()
.
See also
Other complements:
complement_element()
,
complement_set()
,
subtract()
Other methods:
TidySet-class
,
activate()
,
add_column()
,
add_relation()
,
arrange.TidySet()
,
cartesian()
,
complement_element()
,
complement_set()
,
element_size()
,
elements()
,
filter.TidySet()
,
group_by.TidySet()
,
group()
,
incidence()
,
intersection()
,
is.fuzzy()
,
is_nested()
,
move_to()
,
mutate.TidySet()
,
nElements()
,
nRelations()
,
nSets()
,
name_elements<-()
,
name_sets<-()
,
name_sets()
,
power_set()
,
pull.TidySet()
,
relations()
,
remove_column()
,
remove_element()
,
remove_relation()
,
remove_set()
,
rename_elements()
,
rename_set()
,
select.TidySet()
,
set_size()
,
sets()
,
subtract()
,
union()
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