\HeaderA{merge}{Merge RGList\_CALIB or SpikeList objects}{merge}
\methaliasA{merge.RGList\_CALIB}{merge}{merge.RGList.Rul.CALIB}
\methaliasA{merge.SpikeList}{merge}{merge.SpikeList}
\keyword{manip}{merge}
\begin{Description}\relax
Merge two \code{RGList\_CALIB} objects or two \code{SpikeList} objects 
in possibly irregular order.
\end{Description}
\begin{Usage}
\begin{verbatim}
 ## S3 method for class 'RGList_CALIB':
 merge(x,y,...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an \code{RGList\_CALIB} object or an \code{SpikeList} object.
\item[\code{y}] corresponding \code{RGList\_CALIB} object or \code{SpikeList} 
object. Has the same genes or spikes as \code{x}, possibly in a different
order,but with different arrays. 
\item[\code{...}] other arguments can be used in \code{\LinkA{merge}{merge}} in the base packge.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{\LinkA{RGList\_CALIB}{RGList.Rul.CALIB}} and \code{\LinkA{SpikeList}{SpikeList}} 
objects are list objects containing numeric matrices with the same dimensions. 
The RGLists\_CALIB or SpikeLists are merged by merging each of the components by row 
names or, if there are no row names, by IDs in the \code{genes} component. Unlike
when using \code{cbind}, row names are not required to be in the same order
or to be unique. In the case of repeated row names, the order of the rows with 
repeated names in preserved. This means that the first occurrence of each name 
in \code{x\$R} is matched with the first occurrence of the same name in \code{y\$R},
the second with the second, and so on. The final vector of row names is the same 
as in \code{x}.
\end{Details}
\begin{Value}
An merged object of the same class as \code{x} and \code{y} with the same components as
\code{x}. Components matrices have the same row names as in \code{x} but columns from
\code{y} as well as \code{x}.
\end{Value}
\begin{Note}\relax
If the \code{RGList\_CALIB} or \code{SpikeList} objects contain the same number of genes 
or spikes in the same order then the appropriate function to combine them is 
\code{\LinkA{cbind}{cbind}} rather than \code{merge}.
\end{Note}
\begin{Author}\relax
Hui Zhao
\end{Author}
\begin{References}\relax
\code{\LinkA{merge}{merge}} in limma package
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{merge}{merge}} in the base package

\code{\LinkA{merge}{merge}} in the limma package
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

R1 <- G1 <- matrix(1:8,4,2)
rownames(R1) <- rownames(G1) <- c("g1","g1","g2","g3")
colnames(R1) <- colnames(G1) <- c("a1","a2")
RG1 <- new("RGList_CALIB",list(R=R1,G=G1))

R2 <- G2 <- matrix(9:16,4,2)
rownames(R2) <- rownames(G2) <- c("g2","g3","g1","g1")
colnames(R2) <- colnames(G2) <- c("a3","a4")
RG2 <- new("RGList_CALIB",list(R=R2,G=G2))

RG12 <- merge(RG1,RG2)
RG21 <- merge(RG2,RG1)

\end{ExampleCode}
\end{Examples}

