Use group_by to group the TidySet object. You can use activate with group_by or with the whole data.
Usage
# S3 method for class 'TidySet'
group_by(.data, ...)
See also
dplyr::group_by()
and activate()
Other methods:
TidySet-class
,
activate()
,
add_column()
,
add_relation()
,
arrange.TidySet()
,
cartesian()
,
complement_element()
,
complement_set()
,
complement()
,
element_size()
,
elements()
,
filter.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", rep("a2", 5), "b2"),
elements = rep(letters[seq_len(6)], 2),
fuzzy = runif(12)
)
a <- tidySet(relations)
elements(a) <- cbind(elements(a),
type = c(rep("Gene", 4), rep("lncRNA", 2))
)
group_by(a, elements)
#> # A tibble: 12 × 4
#> # Groups: elements [6]
#> elements sets fuzzy type
#> <chr> <chr> <dbl> <chr>
#> 1 a a 0.709 Gene
#> 2 b a 0.874 Gene
#> 3 c a 0.0115 Gene
#> 4 d a 0.888 Gene
#> 5 e a 0.996 lncRNA
#> 6 f b 0.500 lncRNA
#> 7 a a2 0.359 Gene
#> 8 b a2 0.775 Gene
#> 9 c a2 0.584 Gene
#> 10 d a2 0.634 Gene
#> 11 e a2 0.859 lncRNA
#> 12 f b2 0.567 lncRNA