Given two sets creates new sets with one element of each set
Usage
cartesian(object, set1, set2, name = NULL, ...)
# S3 method for class 'TidySet'
cartesian(
object,
set1,
set2,
name = NULL,
keep = TRUE,
keep_relations = keep,
keep_elements = keep,
keep_sets = keep,
...
)
Arguments
- object
A TidySet object.
- set1, set2
The name of the sets to be used for the cartesian product
- name
The name of the new set.
- ...
Placeholder for other arguments that could be passed to the method. Currently not used.
- keep
A logical value if you want to keep.
- 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.
See also
Other methods:
TidySet-class
,
activate()
,
add_column()
,
add_relation()
,
arrange.TidySet()
,
complement_element()
,
complement_set()
,
complement()
,
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
relations <- data.frame(
sets = c(rep("a", 5), "b"),
elements = letters[seq_len(6)]
)
TS <- tidySet(relations)
cartesian(TS, "a", "b")
#> elements sets fuzzy
#> 1 a a 1
#> 2 b a 1
#> 3 c a 1
#> 4 d a 1
#> 5 e a 1
#> 6 f b 1
#> 7 a a⨯b_1 1
#> 8 f a⨯b_1 1
#> 9 b a⨯b_2 1
#> 10 f a⨯b_2 1
#> 11 c a⨯b_3 1
#> 12 f a⨯b_3 1
#> 13 d a⨯b_4 1
#> 14 f a⨯b_4 1
#> 15 e a⨯b_5 1
#> 16 f a⨯b_5 1
#> 17 a a⨯b 1
#> 18 f a⨯b 1
#> 19 b a⨯b 1
#> 20 c a⨯b 1
#> 21 d a⨯b 1
#> 22 e a⨯b 1