\HeaderA{reverseSplit}{A function to reverse the role of names and values in a list.}{reverseSplit}
\keyword{manip}{reverseSplit}
\begin{Description}\relax
Given a list with names \code{x} and values in a set \code{y} this function
returns a list with names in \code{y} and values in \code{x}.
\end{Description}
\begin{Usage}
\begin{verbatim}
reverseSplit(inList)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{inList}] A named list with values that are vectors. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
First the list is unrolled to provide a two long vectors, names are repeated,
once for each of their values. Then the names are \code{split} by the values.

This turns out to be useful for inverting mappings between one set of 
identifiers and an other.
\end{Details}
\begin{Value}
A list with length equal to the number of distinct values in the input list
and values from the names of the input list.
\end{Value}
\begin{Author}\relax
R. Gentleman
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{split}{split}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
 l1 = list(a=1:4, b=c(2,3), d=c(4,5))
 reverseSplit(l1)

\end{ExampleCode}
\end{Examples}

