cbind2-method: Concatenate sparse matrices by columns

cbind2-methodR Documentation

Concatenate sparse matrices by columns

Description

'cbind2' method for the CSR and COO 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 'TsparseMatrix,TsparseMatrix'
cbind2(x, y)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Arguments

x

First matrix to concatenate.

y

Second matrix to concatenate.

Value

A sparse matrix (storage order varying depending on the input types).

Examples

library(Matrix)
library(MatrixExtra)
set.seed(1)
X <- rsparsematrix(3, 4, .3)
X <- as(X, "TsparseMatrix")
inherits(cbind2(X, X), "TsparseMatrix")

MatrixExtra documentation built on Aug. 21, 2023, 1:08 a.m.