Functions to help to perform some action to just some type of data: elements,
sets or relations.
activate
: To table the focus of future manipulations: elements, sets
or relations.
active
: To check the focus on the TidySet
.
deactivate
: To remove the focus on a specific TidySet
-
See also
Other methods:
TidySet-class
,
add_column()
,
add_relation()
,
arrange.TidySet()
,
cartesian()
,
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", 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))
)
# Filter in the whole TidySet
filter(a, elements == "a")
#> elements sets fuzzy type
#> 1 a a 0.08075014 Gene
#> 2 a a2 0.49777739 Gene
filter(a, elements == "a", type == "Gene")
#> elements sets fuzzy type
#> 1 a a 0.08075014 Gene
#> 2 a a2 0.49777739 Gene
# Equivalent to filter_elements
filter_element(a, type == "Gene")
#> elements sets fuzzy type
#> 1 a a 0.08075014 Gene
#> 2 b a 0.83433304 Gene
#> 3 c a 0.60076089 Gene
#> 4 d a 0.15720844 Gene
#> 5 a a2 0.49777739 Gene
#> 6 b a2 0.28976724 Gene
#> 7 c a2 0.73288199 Gene
#> 8 d a2 0.77252151 Gene
a <- activate(a, "elements")
active(a)
#> [1] "elements"
filter(a, type == "Gene")
#> elements sets fuzzy type
#> 1 a a 0.08075014 Gene
#> 2 b a 0.83433304 Gene
#> 3 c a 0.60076089 Gene
#> 4 d a 0.15720844 Gene
#> 5 a a2 0.49777739 Gene
#> 6 b a2 0.28976724 Gene
#> 7 c a2 0.73288199 Gene
#> 8 d a2 0.77252151 Gene
a <- deactivate(a)
active(a)
#> NULL
filter(a, type == "Gene")
#> elements sets fuzzy type
#> 1 a a 0.08075014 Gene
#> 2 b a 0.83433304 Gene
#> 3 c a 0.60076089 Gene
#> 4 d a 0.15720844 Gene
#> 5 a a2 0.49777739 Gene
#> 6 b a2 0.28976724 Gene
#> 7 c a2 0.73288199 Gene
#> 8 d a2 0.77252151 Gene