\Header{cols2Env}{Creates a environment object using data from two columns of a matrix}
\alias{matchAll}{cols2Env}
\alias{matchOneRow}{cols2Env}
\keyword{manip}{cols2Env}
\begin{Description}\relax
Given a matrix with two columns, this function creates an environment
object with values in one of the specified columns as keys and those in the
other column as values.\end{Description}
\begin{Usage}
\begin{verbatim}
cols2Env(cols, colNames, keyColName = colNames[1], sep)
matchAll(cols, keyColName)
matchOneRow(cols, keyColName, sep = ";")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{cols}] \code{cols} a matrix with two columns
\item[\code{colNames}] \code{colNames} a charcter string for the name of the
column whose values will be used for the keys of the environment
object to be created
\item[\code{keyColName}] \code{keyColName} a character string for the name of
the column whose values will be the corresponding values for keys of
the environment object to be created
\item[\code{sep}] \code{sep} a character for the separaters used to separate
entries that have multiple values
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The matrix or matrix convertable object passed to cols2Env must have
two coloumns with one intented to be used as the key and the other be the
value.

Cells in either or both columns may have multiple values separated by a
separator (e.g. "a;b", "1;2;3") making the mapping between keys and
the corresponding values not a straitforward operation. cols2Env gets
all the unique values from the key column by spliting them and maps
values to each of them.

\code{\Link{cols2Env}} calls \code{\Link{matchAll}} that in turn calls
\code{\Link{matchOneRow}} to first split entries and then map entries
in the two coloumns on one to one bases. Unique keys in the column
defined as the key column will be assigned a vector containing all the
values corresponding the keys in the environment to return.\end{Details}
\begin{Value}
This function returns an environment object with key and value pairs\end{Value}
\begin{Note}\relax
This function is part of the Bioconductor project at Dana-Farber
Cancer Institute to provide Bioinformatics functionalities through R\end{Note}
\begin{Author}\relax
Jianhua Zhang\end{Author}
\begin{SeeAlso}\relax
\code{\Link{ABPkgBuilder}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
dataM <- matrix(c("a;b", "1;2;3", "a;b", "4;5", "c", "6;7", "b;a",
"6;7;8"), ncol = 2, byrow = TRUE)

temp <- cols2Env(dataM, c("key", "value"), keyColName = "key")

dataM
multiget(ls(temp), temp)

\end{ExampleCode}
\end{Examples}

