stack {annmatrix}R 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)


[Package annmatrix version 0.1.2 Index]