View source: R/combineRedBasedOnCol.R
combineRedBasedOnCol | R Documentation |
This function works similar to unique
, but it takes a matrix as input and considers one specified column to find unique instances.
It identifies 'repeated' lines of the input-matrix (or data.frame) 'mat' based on (repeated) elements in/of column with name 'colNa' (or column-number).
Redundant lines (ie repeated lines) will disappear in output.
Eg used with extracted annotation where 1 gene has many lines for different GO annotation.
combineRedBasedOnCol(mat, colNa, sep = ",", silent = FALSE, callFrom = NULL)
mat |
input matrix or data.frame |
colNa |
character vector (length 1) macting 1 column name (if mult only 1st will be used), in case of mult matches only 1st used |
sep |
(character) separator (default=",") |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of messages produced |
matrix containing the input matrix without lines considered repeated (unique-like)
findRepeated
, firstOfRepLines
, organizeAsListOfRepl
, combineRedundLinesInList
matr <- matrix(c(letters[1:6],"h","h","f","e",LETTERS[1:5]),ncol=3,
dimnames=list(letters[11:15],c("xA","xB","xC")))
combineRedBasedOnCol(matr,colN="xB")
combineRedBasedOnCol(rbind(matr[1,],matr),colN="xB")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.