Skip to contents

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-

Usage

activate(.data, what)

active(.data)

deactivate(.data)

Arguments

.data

A TidySet object.

what

Either "elements", "sets" or "relations"

Value

A TidySet object.

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