\HeaderA{cBind}{Versions of 'cbind' and 'rbind' recursively built on cbind2/rbind2}{cBind}
\aliasA{rBind}{cBind}{rBind}
\keyword{array}{cBind}
\keyword{manip}{cBind}
\begin{Description}\relax
The base functions \code{\LinkA{cbind}{cbind}} and \code{\LinkA{rbind}{rbind}} are
defined for an arbitrary number of arguments and hence have the first
formal argument \code{...}.  For that reason, S4 methods cannot easily
be defined for binding together matrices inheriting from \code{\LinkA{Matrix}{Matrix}}.

For that reason, \code{\LinkA{cbind2}{cbind2}} and \code{\LinkA{rbind2}{rbind2}} have
been provided for binding together \emph{two} matrices, and we have
defined methods for these and the \code{'Matrix'}-matrices.

As a substitute for \emph{S4-enabled} versions of \code{cbind} and
\code{rbind}, you can use \code{cBind} and \code{rBind} with identical
syntax and semantic in order to bind together multiple matrices
(\code{"matrix"} or \code{"Matrix"} and vectors.
\end{Description}
\begin{Usage}
\begin{verbatim}
cBind(..., deparse.level = 1)
rBind(..., deparse.level = 1)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{...}] matrix-like \R{} objects to be bound together, see
\code{\LinkA{cbind}{cbind}} and \code{\LinkA{rbind}{rbind}}.
\item[\code{deparse.level}] integer determining under which circumstances
column and row names are built from the actual arguments'
\sQuote{expression}, see \code{\LinkA{cbind}{cbind}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The implementation of these is \emph{recursive}, calling
\code{\LinkA{cbind2}{cbind2}} or
\code{\LinkA{rbind2}{rbind2}} respectively, where these have methods
defined and so should dispatch appropriately.
\end{Details}
\begin{Value}
typically a \sQuote{matrix-like} object of a similar
\code{\LinkA{class}{class}} as the first argument in \code{...}.
\end{Value}
\begin{Author}\relax
Martin Maechler
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{cbind2}{cbind2}}, \code{\LinkA{cbind}{cbind}},
\code{\LinkA{Methods}{Methods}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
(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
\end{ExampleCode}
\end{Examples}

