stack {annmatrix} | R Documentation |
Turns annmatrix into a data frame by transforming the matrix along with row and column annotations into separate data frame columns.
## S3 method for class 'annmatrix'
stack(x, ...)
x |
annmatrix object. |
... |
further arguments passed to or from methods. |
transposed annmatrix object
Karolis Koncevičius
# 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)