Learn R Programming

annmatrix (version 0.1.2)

print: Print annmatrix Object

Description

Functions that print an annmatrix object

Usage

# S3 method for annmatrix
print(x, nrow = 5, ncol = 5, digits = getOption("digits"), ...)

Value

invisibly returns annmatrix object.

Arguments

x

a matrix.

nrow

number of rows to display (default is 5).

ncol

number of columns to display (default is 5).

digits

number of digits to display (default set to getOptions("digits")).

...

further arguments passed to or from methods.

Author

Karolis Koncevičius

Details

annmatrix objects are printed in a shortened form (5 rows and 5 columns by default). In addition the function displays information about available meta-data for rows and columns.

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)

print(X)
print(X, 10, 5)
print(X, 2, 2)

# also works with a list-based matrix
x <- matrix(list(mtcars, iris3, USAccDeaths, rivers), ncol=2)
print(x)
X <- annmatrix(x)
print(X)

Run the code above in your browser using DataLab