stack: Stack an annmatrix object

stackR Documentation

Stack an annmatrix object

Description

Turns annmatrix into a data frame by transforming the matrix along with row and column annotations into separate data frame columns.

Usage

## S3 method for class 'annmatrix'
stack(x, ...)

Arguments

x

annmatrix object.

...

further arguments passed to or from methods.

Value

transposed annmatrix object

Author(s)

Karolis Koncevičius

Examples

# construct annmatrix object
x <- matrix(rnorm(20*10), 20, 10)

coldata <- data.frame(group  = rep(c("case", "control"), each = 5),
                      gender = sample(c("M", "F"), 10, replace = TRUE))

rowdata <- data.frame(chr = sample(c("chr1", "chr2"), 20, replace = TRUE),
                      pos = runif(20, 0, 1000000))

X <- annmatrix(x, rowdata, coldata)

# stack all information into a long-format data.frame
Y <- stack(X)


KKPMW/annMatrix documentation built on May 16, 2023, 3:48 a.m.