| foreign {spam} | R Documentation |
Transform between the spam sparse format to the
matrix.csr format of SparseM and dgRMatrix format of Matrix
as.spam.matrix.csr(x) # as.matrix.csr.spam(x) as.dgRMatrix.spam(x) as.dgCMatrix.spam(x) as.spam.dgRMatrix(x) as.spam.dgCMatrix(x)
x |
sparse matrix of class spam, matrix.csr,
dgRMatrix or dgCMatrix. |
We do not provide any S4 methods and because of the existing
mechanism a standard S3 does not work.
The functions are based on require.
Notice that as.matrix.csr.spam should read as as."matrix.csr".spam.
According to the call, a sparse matrix of class spam,
matrix.csr, dgRMatrix or dgCMatrix.
Reinhard Furrer
triplet, Matrix or matrix.csr
## Not run: S <- diag.spam(4) U <- as.matrix.csr.spam( S) R <- as.dgRMatrix.spam( S) C <- as.dgCMatrix.spam( S) as.spam.dgCMatrix(C) slotNames(U) slotNames(R) # For column oriented sparse formats a transpose does not the job, # as the slot names change. # as.spam(R) does not work. ## End(Not run) ## Not run: # a dataset contained in Matrix data(KNex) as.spam.dgCMatrix(KNex$mm) ## End(Not run)