# cBind

##### Versions of 'cbind' and 'rbind' recursively built on cbind2/rbind2

The base functions `cbind`

and `rbind`

are
defined for an arbitrary number of arguments and hence have the first
formal argument `...`

. For that reason, S4 methods cannot easily
be defined for binding together matrices inheriting from `Matrix`

.

For that reason, `cbind2`

and `rbind2`

have
been provided for binding together *two* matrices, and we have
defined methods for these and the `'Matrix'`

-matrices.

As a substitute for *S4-enabled* versions of `cbind`

and
`rbind`

, you can use `cBind`

and `rBind`

with identical
syntax and semantic in order to bind together multiple matrices
(`"matrix"`

or `"Matrix"`

and vectors.

##### Usage

```
cBind(..., deparse.level = 1)
rBind(..., deparse.level = 1)
```

##### Arguments

##### Details

The implementation of these is *recursive*, calling
`cbind2`

or
`rbind2`

respectively, where these have methods
defined and so should dispatch appropriately.

##### Value

- typically a
matrix-like object of a similar`class`

as the first argument in`...`

.

##### See Also

##### Examples

```
(a <- matrix(c(2:1,1:2), 2,2))
cbind(0, rBind(a, 7)) # remains traditional matrix
D <- Diagonal(2)
cBind(4, a, D, -1, D, 0) # a sparse Matrix
```

*Documentation reproduced from package Matrix, version 0.99875-0, License: GPL version 2 or later. This R package includes libraries CHOLMOD, AMD, COLAMD and CSparse from the University of Florida sparse matrix library maintained by Tim Davis. All sections of that code are covered by the GPL or LGPL licenses. See the directory doc/UFsparse for details.*