Identify if a cell is an outlier based on a metric

Description

Convenience function to determine which values for a metric are outliers based on median-absolute-deviation (MAD).

Usage

1
2
isOutlier(metric, nmads = 5, type = c("both", "lower", "higher"),
  log = FALSE, na.rm = FALSE)

Arguments

metric

numeric or integer vector of values for a metric

nmads

scalar, number of median-absolute-deviations away from median required for a value to be called an outlier

type

character scalar, choice indicate whether outliers should be looked for at both tails (default: "both") or only at the lower end ("lower") or the higher end ("higher")

log

logical, should the values of the metric be transformed to the log10 scale before computing median-absolute-deviation for outlier detection?

na.rm

logical, should NA (missing) values be removed before computing median and median-absolute-deviation values? If FALSE then return values for median and median-absolute-deviation will be NA if any value is NA.

Value

a logical vector of the same length as the metric argument

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data("sc_example_counts")
data("sc_example_cell_info")
pd <- new("AnnotatedDataFrame", data=sc_example_cell_info)
rownames(pd) <- pd$Cell
example_sceset <- newSCESet(countData=sc_example_counts, phenoData=pd)
example_sceset <- calculateQCMetrics(example_sceset)

## with a set of feature controls defined
example_sceset <- calculateQCMetrics(example_sceset, feature_controls = 1:40)
isOutlier(example_sceset$total_counts, nmads = 3)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.