Use filter to subset the TidySet object. You can use activate with filter or use the specific function. The S3 method filters using all the information on the TidySet.
Usage
# S3 method for class 'TidySet'
filter(.data, ...)
filter_set(.data, ...)
filter_element(.data, ...)
filter_relation(.data, ...)
See also
dplyr::filter()
and activate()
Other methods:
TidySet-class
,
activate()
,
add_column()
,
add_relation()
,
arrange.TidySet()
,
cartesian()
,
complement_element()
,
complement_set()
,
complement()
,
element_size()
,
elements()
,
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", rep("a2", 5), "b2"),
elements = rep(letters[seq_len(6)], 2),
fuzzy = runif(12),
type = c(rep("Gene", 4), rep("lncRNA", 2))
)
TS <- tidySet(relations)
TS <- move_to(TS, from = "relations", to = "elements", column = "type")
filter(TS, elements == "a")
#> elements sets fuzzy type
#> 1 a a 0.4007202 Gene
#> 2 a a2 0.5185566 Gene
# Equivalent to filter_relation
filter(TS, elements == "a", sets == "a")
#> elements sets fuzzy type
#> 1 a a 0.4007202 Gene
filter_relation(TS, elements == "a", sets == "a")
#> elements sets fuzzy type
#> 1 a a 0.4007202 Gene
# Filter element
filter_element(TS, type == "Gene")
#> elements sets fuzzy type
#> 1 a a 0.40072018 Gene
#> 2 b a 0.21317271 Gene
#> 3 c a 0.67176682 Gene
#> 4 d a 0.05861411 Gene
#> 5 a a2 0.51855664 Gene
#> 6 b a2 0.84612005 Gene
#> 7 c a2 0.71826972 Gene
#> 8 d a2 0.24131402 Gene
# Filter sets and by property of elements simultaneously
filter(TS, sets == "b", type == "lncRNA")
#> elements sets fuzzy type
#> 1 f b 0.1490355 lncRNA
# Filter sets
filter_set(TS, sets == "b")
#> elements sets fuzzy type
#> 1 f b 0.1490355 lncRNA