Learn R Programming

wrMisc (version 1.2.3)

filterList: Filter for unique elements

Description

This function aims to identify and remove duplicated elements in a list and maintain the list-structure in the output. filtSizeUniq filters 'lst' (list of character-vectors or character-vector) for elements being unique (to 'ref' or if NULL to all 'lst') and of character length. In addition, the min- and max- character length may be filtered, too. Eg, in proteomics this helps removing peptide sequences which would not be measured/detected any way.

Usage

filterList(lst, filt, minLineRatio = 0.5, silent = FALSE, callFrom = NULL)

Arguments

lst

(list) main input, each vector, matrix or data.frame in this list will be filtered if its length or number of lines fits to filt

filt

(logical) vector of FALSE/TRUE to use for filtering. If this a matrix is given, the value of minLineRatio will be applied as threshod of min content of TRUE for each line of filt

minLineRatio

(numeric) in case filt is a matrix of FALSE/TRUE, this value will be used as threshold of min content of TRUE for each line of filt

silent

(logical) suppress messages

callFrom

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

Value

list of filtered input

See Also

correctToUnique, unique, duplicated, extrColsDeX

Examples

Run this code
# NOT RUN {
set.seed(2020); dat1 <- round(runif(80),2)
list1 <- list(m1=matrix(dat1[1:40],ncol=8),m2=matrix(dat1[41:80],ncol=8),other=letters[1:8])
rownames(list1$m1) <- rownames(list1$m2) <- paste0("line",1:5)
filterList(list1, list1$m1[,1] >0.4) 
filterList(list1, list1$m1 >0.4) 
# }

Run the code above in your browser using DataLab