Learn R Programming

Matrix (version 1.2-1)

dgCMatrix-class: Compressed, sparse, column-oriented numeric matrices

Description

The dgCMatrix class is a class of sparse numeric matrices in the compressed, sparse, column-oriented format. In this implementation the non-zero elements in the columns are sorted into increasing row order. dgCMatrix is the standard class for sparse numeric matrices in the Matrix package.

Arguments

Objects from the Class

Objects can be created by calls of the form new("dgCMatrix", ...), more typically via as(*, "CsparseMatrix") or similar. Often however, more easily via Matrix(*, sparse = TRUE), or most efficiently via sparseMatrix().

See Also

Classes dsCMatrix, dtCMatrix, lu

Examples

Run this code
(m <- Matrix(c(0,0,2:0), 3,5))
str(m)
m[,1]
## regression test: this must give a validity-check error:
stopifnot(inherits(try(new("dgCMatrix", i = 0:1, p = 0:2,
                           x = c(2,3), Dim = 3:4)),
          "try-error"))

Run the code above in your browser using DataLab