cols2Env {AnnBuilder}R Documentation

Creates a environment object using data from two columns of a matrix

Description

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.

Usage

cols2Env(cols, colNames, keyColName = colNames[1], sep)
matchAll(cols, keyColName)
matchOneRow(cols, keyColName, sep = ";")

Arguments

cols cols a matrix with two columns
colNames 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
keyColName 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
sep sep a character for the separaters used to separate entries that have multiple values

Details

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.

cols2Env calls matchAll that in turn calls 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.

Value

This function returns an environment object with key and value pairs

Note

This function is part of the Bioconductor project at Dana-Farber Cancer Institute to provide Bioinformatics functionalities through R

Author(s)

Jianhua Zhang

See Also

ABPkgBuilder

Examples

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)


[Package Contents]