R: Concatenate sparse matrices/vectors by rows

rbind2-method {MatrixExtra} | R Documentation

## Concatenate sparse matrices/vectors by rows

### Description

'rbind2' method for the sparse matrix and sparse vector classes from 'Matrix', taking the most efficient route for the concatenation according to the input types.

### Usage

    ## S4 method for signature 'RsparseMatrix,RsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'sparseVector,RsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'RsparseMatrix,sparseVector'
    rbind2(x, y)

    ## S4 method for signature 'sparseVector,sparseVector'
    rbind2(x, y)

    ## S4 method for signature 'CsparseMatrix,CsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'sparseVector,CsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'CsparseMatrix,sparseVector'
    rbind2(x, y)

    ## S4 method for signature 'CsparseMatrix,CsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'RsparseMatrix,CsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'CsparseMatrix,RsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'RsparseMatrix,TsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'TsparseMatrix,RsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'RsparseMatrix,numeric'
    rbind2(x, y)

    ## S4 method for signature 'RsparseMatrix,integer'
    rbind2(x, y)

    ## S4 method for signature 'RsparseMatrix,logical'
    rbind2(x, y)

    ## S4 method for signature 'numeric,RsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'integer,RsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'logical,RsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'TsparseMatrix,TsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'TsparseMatrix,sparseVector'
    rbind2(x, y)

    ## S4 method for signature 'sparseVector,TsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'TsparseMatrix,CsparseMatrix'
    rbind2(x, y)

    ## S4 method for signature 'CsparseMatrix,TsparseMatrix'
    rbind2(x, y)

### Arguments

`x` | First matrix to concatenate.
`y` | Second matrix to concatenate.

### Value

A sparse matrix, usually in CSR format but some combinations might return COO or CSC.

### Examples

    library(Matrix)
    library(MatrixExtra)
    set.seed(1)
    X <- rsparsematrix(3, 4, .3)
    X <- as(X, "RsparseMatrix")
    inherits(rbind2(X, X), "RsparseMatrix")
    inherits(rbind(X, X, as.csc.matrix(X), X), "RsparseMatrix")
    inherits(rbind2(as.coo.matrix(X), as.coo.matrix(X)), "TsparseMatrix")
    inherits(rbind2(as.csc.matrix(X), as.csc.matrix(X)), "CsparseMatrix")

[Package MatrixExtra version 0.1.9-1 Index]