Skip to contents

Mutate a SummarizedExperiment object under an data mask. Unlike a few other dplyr implementations, all contextual evaluations of mutate() for SummarizedExperiment are valid.

Usage

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

Arguments

.data

an objecting inheriting SummarizedExperiment class

...

expressions to evaluate

Value

an object inheriting SummarizedExperiment class

Examples


mutate(se_simple,
    counts_1 = counts + 1,
    logp_counts = log(counts_1),
    # access assays context with ".assays" pronoun,
    # note that assays are sliced into a list to 
    # fit dimensions of cols context
    cols(sum = purrr::map_dbl(.assays$counts, sum)),
    # access assays context "asis" with the same pronoun
    # but with a "_asis" suffix.
    rows(sum = rowSums(.assays_asis$counts))
)
#> class: SummarizedExperiment 
#> dim: 5 4 
#> metadata(0):
#> assays(4): counts logcounts counts_1 logp_counts
#> rownames(5): row_1 row_2 row_3 row_4 row_5
#> rowData names(4): gene length direction sum
#> colnames(4): col_1 col_2 col_3 col_4
#> colData names(3): sample condition sum