Skip to contents

Combine multiple objects

Usage

combine(x, y, ...)

# S4 method for SummarizedExperiment,SummarizedExperiment
combine(x, y)

Arguments

x

Object.

y

Object.

...

Additional arguments.

Value

A single value of the same class as the input values.

Details

We're attempting to make this as strict as possible, requiring:

  • Rows (genes) across objects must be identical.

  • rowRanges and/or rowData metadata must be identical.

  • colData must contain the same columns.

  • Specific metadata must be identical (see metadata argument).

Note

Updated 2022-05-23.

See also

  • help("merge.Matrix", "Matrix.utils").

Examples

data(RangedSummarizedExperiment, package = "AcidTest")

## SummarizedExperiment ====
x <- RangedSummarizedExperiment
colnames(x) <- paste0(
    "sample",
    sprintf("%02d", seq_len(ncol(x)))
)

y <- x
colnames(y) <- paste0(
    "sample",
    sprintf("%02d", seq(from = ncol(y) + 1L, to = ncol(y) * 2L))
)

## Combine the two objects.
c <- combine(x, y)
#> → Combining objects into `RangedSummarizedExperiment`.
#> → Binding columns in `assays()`: "counts".
#> → Checking row data.
#> → Updating column data.
#> → Updating metadata.
sampleData(c)
#> DataFrame with 24 rows and 3 columns
#>          condition sampleName interestingGroups
#>           <factor>   <factor>          <factor>
#> sample01         A   sample01                 A
#> sample02         A   sample02                 A
#> sample03         A   sample03                 A
#> sample04         A   sample04                 A
#> sample05         A   sample05                 A
#> ...            ...        ...               ...
#> sample20         B   sample20                 B
#> sample21         B   sample21                 B
#> sample22         B   sample22                 B
#> sample23         B   sample23                 B
#> sample24         B   sample24                 B
print(c)
#> class: RangedSummarizedExperiment 
#> dim: 500 24 
#> metadata(4): version date interestingGroups combine
#> assays(1): counts
#> rownames(500): gene001 gene002 ... gene499 gene500
#> rowData names(10): broadClass description ... ncbiGeneId seqCoordSystem
#> colnames(24): sample01 sample02 ... sample23 sample24
#> colData names(1): condition