asAnyMatrix: Convert to matrix or dgCMatrix

View source: R/R_funclib_movAPA.r

asAnyMatrixR Documentation

Convert to matrix or dgCMatrix

Description

asAnyMatrix convert data.frame/matrix/dgCMatrix to matrix or dgCMatrix. For PACdataset@counts in previous movAPA, the data type is data.frame. Please call asAnyMatrix(PACds@counts) to make it compatible to new movAPA. If dat is data-sparse or type-sparse, then return dgCMatrix if dat is data.frame, then return matrix or dgCMatrix (when forceSparse or data-sparse)

Usage

asAnyMatrix(dat, forceSparse = FALSE)

Arguments

dat

a data.frame/matrix/dgCMatrix or any object that can be converted to matrix using as.matrix.

forceSparse

if TRUE, then force the dat to sparse matrix (dgCMatrix)

Value

A matrix or dgCMatrix which can be used as the count slot of a PACdataset.


BMILAB/movAPA documentation built on Jan. 3, 2024, 11:09 p.m.