Learn R Programming

wrProteo (version 1.5.0)

cleanListCoNames: Selective batch cleaning of sample- (ie column-) names in list

Description

This function allows to manipulate sample-names (ie colnames) from data stored as multiple matrixes or data.frames in multiple sheets of a list in a batch-wise manner. Import functions such as readMaxQuantFile() organize initial flat files into lists (of matrixes) of the different types of data. Many times all column names in such lists carry long names including redundant information, like the overall experiment name or date, etc. The aim of this function is to facilitate 'cleaning' the sample- (ie column-) names to obtain short and concise names. Character terms to be removed (via argument rem) and/or replaced/subsitituted (via argument subst) should be given as they are, characters with special behaviour in grep (like '.') will be protected internally. Note, that the character substitution part will be done first, and the removal part (without character replacement) afterwards.

Usage

cleanListCoNames(
  dat,
  rem = NULL,
  subst = c("-", "_"),
  lstE = c("raw", "quant", "counts"),
  silent = FALSE,
  callFrom = NULL
)

Arguments

dat

(list) main input

rem

(character) character string to be removed, may be named 'left' and 'right' for more specific exact pattern matching (this part will be perfomed before character substitutions by subst)

subst

(character of length=2, or matrix with 2 columns) pair(s) of character-strings for replacepent (1st as search-item and 2nd as replacement); this part is performed after character-removal via rem

lstE

(character, length=1) names of list-elements where colnames should be cleaned

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of message(s) produced

Value

list (equivalent to input dat)

See Also

grep

Examples

Run this code
# NOT RUN {
dat1 <- matrix(1:12, ncol=4, dimnames=list(1:3, paste0("sample_R.",1:4)))
dat1 <- list(raw=dat1, quant=dat1, notes="other..") 
cleanListCoNames(dat1, rem=c(left="sample_"),c(".","-")) 
# }

Run the code above in your browser using DataLab