View source: R/presenceGrpFilt.R
presenceGrpFilt | R Documentation |
The aim of this function is to filter for each group of columns for sufficient data as non-NA.
presenceGrpFilt(dat, grp, presThr = 0.75, silent = FALSE, callFrom = NULL)
dat |
matrix or data.frame (abundance or expression-values which may contain some |
grp |
factor of min 2 levels describing which column of 'dat' belongs to which group (levels 1 & 2 will be used) |
presThr |
(numeric) min ratio of non- |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of messages produced |
This function allows to identify lines with an NA
-content above the threshold presThr
per group as defined by the levels of factor grp
.
With different types of projects/questions different threshold presThr
levels may be useful.
For example, if one would like to keep the degree of threshold presThr
s per group rather low, one could use a value of 0.75 (ie >= 75
logical matrix (with on column for each level of grp
)
presenceFilt
, there are also other packages totaly dedicated to filtering on CRAN and Bioconductor
mat <- matrix(NA, nrow=11, ncol=6)
mat[lower.tri(mat)] <- 1
mat <- cbind(mat, mat[,1:4])
colnames(mat) <- c(paste0("re",1:6), paste0("x",1:4))
mat[6:8,7:10] <- mat[1:3,7:10] # ref
mat[9:11,1:6] <- mat[2:4,1:6]
## accept 1 NA out of 4, 2 NA out of 6 (ie certainly present)
(filt0a <- presenceGrpFilt(mat, rep(1:2, c(6,4)), pres=0.66))
## accept 2 NA out of 4, 2 NA out of 6 (ie min 50% present)
(filt0b <- presenceGrpFilt(mat, rep(1:2, c(6,4)), pres=0.5))
## accept 3 NA out of 4, 4 NA out of 6 (ie possibly present)
(filt0c <- presenceGrpFilt(mat, rep(1:2, c(6,4)), pres=0.19))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.