matrixgenerics {annmatrix}R Documentation

Matrix Generic Functions for annmatrix Class

Description

Matrix cross-product operator implemented for annmatrix class

Usage

## S3 method for class 'annmatrix'
x %*% y

Arguments

x, y

numeric or complex matrices or vectors.

Details

The resulting matrix will be the same as a product between two regular matrices. If present annmatrix row annotations will be carried over from the first matrix x while the annotations for rows will be carried over from the second matrix y.

Value

an object of class 'annmatrix'.

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)

res <- 1:20 %*% X
res$group

res <- X %*% 1:10
res@chr

res <- t(X) %*% X
res@group
res$group


[Package annmatrix version 0.1.2 Index]