Learn R Programming

annmatrix (version 0.1.2)

transpose: Transposing annmatrix Objects

Description

Transpose annmatrix along with the associated row and column annotations.

Usage

# S3 method for annmatrix
t(x)

Value

transposed annmatrix object with appropriately adjusted row and column annotations.

Arguments

x

annmatrix object.

Author

Karolis Koncevičius

Examples

Run this code
# 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)

# transposes the main matrix along with row and column annotations
Xt <- t(X)

print(X)
print(Xt)

X@chr
Xt$chr

Run the code above in your browser using DataLab