convert {annmatrix} | R Documentation |
Convert annmatrix Objects to and from Other Types
Description
Methods for turning R objects to class annmatrix and vice versa.
Usage
as.annmatrix(x)
## Default S3 method:
as.annmatrix(x)
## S3 method for class 'matrix'
as.annmatrix(x)
## S3 method for class 'annmatrix'
as.matrix(x, ...)
is.annmatrix(x)
Arguments
x |
an R object. |
... |
additional arguments to be passed to or from methods. |
Details
as.annmatrix
will attempt to convert an object to annmatrix.
as.matrix
will turn an annmatrix
object into a regular matrix.
is.annmatrix
checks if the object is an instance of annmatrix
.
Value
is.annmatrix
returns TRUE if object is of class 'annmatrix' and FALSE otherwise.
as.annmatrix
methods return an object of class 'annmatrix'.
as.matrix
returns a regular matrix.
Author(s)
Karolis Koncevičius
Examples
# construct annmatrix object
x <- matrix(rnorm(20*10), 20, 10)
X <- as.annmatrix(x)
X$group <- rep(c("case", "control"), each = 5)
X$gender <- sample(c("M", "F"), 10, replace = TRUE)
X@chr <- sample(c("chr1", "chr2"), 20, replace = TRUE)
X@pos <- runif(20, 0, 1000000)
is.matrix(x)
is.matrix(X)
is.annmatrix(x)
is.annmatrix(X)
as.matrix(X)
[Package annmatrix version 0.1.2 Index]