combineRedBasedOnCol: Combine/reduce redundant lines based on specified column

View source: R/combineRedBasedOnCol.R

combineRedBasedOnColR Documentation

Combine/reduce redundant lines based on specified column

Description

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.

Usage

combineRedBasedOnCol(mat, colNa, sep = ",", silent = FALSE, callFrom = NULL)

Arguments

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 message(s) produced

Value

matrix containing the input matrix without lines considered repeated (unique-like)

See Also

findRepeated, firstOfRepLines, organizeAsListOfRepl

Examples

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")

wrMisc documentation built on Nov. 17, 2023, 5:09 p.m.