Learn R Programming

spam (version 2.11-0)

cbind: Combine Sparse Matrices by Rows or Columns

Description

Take a sequence of vector, matrix or spam object arguments and combine by columns or rows, respectively.

Usage

# cbind(\dots, force64 = getOption("spam.force64"), deparse.level = 0)
# rbind(\dots, deparse.level = 0)

Value

a spam object combining the ... arguments column-wise or row-wise. (Exception: if there are no inputs or all the inputs are NULL, the value is NULL.)

Arguments

...

vectors, matrices or spam objects. See ‘Details’ and ‘Value’

force64

logical vector of length 1. If TRUE, a 64-bit spam matrix is returned in any case. If FALSE, a 32-bit matrix is returned when possible.

deparse.level

for compatibility reason here. Only 0 is implemented.

Author

Reinhard Furrer

Details

rbind and cbind are not exactly symmetric in how the objects are processed. cbind calls a Fortran routine after the input has been coerced to spam objects. Whereas rbind calls a Fortran routine only in the case of to spam matrices. Note that row binding is essentially an concatenation of the slots due to the sparse storage format.

Only two objects at a time are processed. If more than two are present, a loop concatenates them successively.

A method is defined for a spam object as first argument.

Examples

Run this code
x <- cbind.spam(1:5,6)

y <- cbind(x, 7)

rbind( x, x)
# for some large matrices   t( cbind( t(x), t(x)))
# might be slightly faster:


Run the code above in your browser using DataLab