BiocSet-methods {BiocSet} | R Documentation

## BiocSet methods

### Description

`es_activate`: which of the three tibbles in the `BiocSet` object should be activated and have the chosen functionality applied to it.

`filter`: choose rows where conditions are true.

`select`: keep only the variables listed.

`mutate`: add new variable and preserve the existing variables.

`summarise`: usually used with `group_by()`, output will have one row for each group.

`arrange`: order rows by an expression involving its variables.

`.tbl_nongroup_vars`: returns only non-grouping variables.

`group_by`: converts an existing tbl into a grouped tbl.

`left_join`: returns all rows from `x`, and all columns from `x` and `y`. If no rows in `x` match with `y` there will be `NA`s in the new column. If there are multiple matches then all combinations are returned.

`as.list`: coerces argument into a list.

`union`: combines all rows from two `BiocSet` objects and removes duplicate records from the combined `BiocSet` object.

`intersect`: combines all rows from two `BiocSet` objects and returns rows that appear in both `BiocSet` objects.

### Usage

    es_activate(.data, what)

    ## S3 method for class 'BiocSet'
    filter(.data, ...)

    ## S3 method for class 'BiocSet'
    select(.data, ...)

    ## S3 method for class 'BiocSet'
    mutate(.data, ...)

    ## S3 method for class 'BiocSet'
    summarise(.data, ...)

    ## S3 method for class 'BiocSet'
    arrange(.data, ...)

    .tbl_nongroup_vars.BiocSet(x)

    ## S3 method for class 'BiocSet'
    group_by(.data, ..., add = FALSE)

    ## S3 method for class 'BiocSet'
    left_join(x, y, by, copy, suffix, ...)

    ## S3 method for class 'BiocSet'
    as.list(x, ...)

    ## S3 method for class 'BiocSet'
    union(x, y, ...)

    ## S3 method for class 'BiocSet'
    intersect(x, y, ...)

### Arguments

`.data` | The `BiocSet` object.
`what` | Which of the three tibbles from `BiocSet` to activate.
`...` | Additional arguments passed to function.
`x` | For `.tbl_nongroup_vars` (internal), a `BiocSet` object. For `union` and `intersect` the first `BiocSet` object to perform the operations on.
`add` | logical, whether to add to the existing groups.
`y` | For `left_join`, a tibble to join. For `union` and `intersect` the second `BiocSet` object used.
`by` | A character vector of variables to join by.
`copy` | logical, allows you to join tables across srcs.
`suffix` | Character vector of length 2, if there are non-joined duplicate variables in 'x' and 'y' these suffixes will be added to the output.

### Value

A `BiocSet` object.

### Examples

    es <- BiocSet(set1 = letters, set2 = LETTERS)
    es_activate(es, element)

    es %>% es_activate(element) %>% filter(element == "a")

    es %>% select(element)

    es %>% es_activate(set) %>% mutate(pval = rnorm(1:2))

    es %>% es_activate(set) %>% summarise(n = n())

    es %>% es_activate(element) %>% arrange(desc(element))

    es %>% mutate(pval = rnorm(1:52)) %>% es_elementset() %>%
        BiocSet:::.tbl_nongroup_vars()

    es %>% group_by(element, set)

    es <- BiocSet(set1 = letters[1:5], set2 = LETTERS[1:5])
    tbl <- tibble(x = 1:10, y = c(letters[1:5], LETTERS[1:5]))
    es %>% left_join(tbl, by = c(element = "y"))

    library(org.Hs.eg.db)
    es <- go_sets(org.Hs.eg.db, "ENSEMBL")
    head(as.list(es))

    es1 <- BiocSet(set1 = letters[c(1:4)], set2 = LETTERS[c(1:4)])
    es2 <- BiocSet(set1 = letters[c(3:8)], set2 = LETTERS[c(3:8)])

    dplyr::union(es1, es2)

    dplyr::intersect(es1, es2)

[Package BiocSet version 1.0.1 Index]