Skip to contents

Mark absorbance outliers

Usage

qp_mark_outliers(x, ignore_outliers = c("all", "standards", "samples", "none"))

# S3 method for data.frame
qp_mark_outliers(x, ignore_outliers = c("all", "standards", "samples", "none"))

# S3 method for list
qp_mark_outliers(x, ignore_outliers = c("all", "standards", "samples", "none"))

Arguments

x

A data.frame or list containing a data.frame named qp. See details.

ignore_outliers

Which sample types should have outliers marked?

Value

The input tibble with an .is_outlier column

Details

Input data.frame must contain the following columns:

  • sample_type. Character. Must contain values either "standard" or "unknown"

  • index. Numeric. Denotes sample number.

  • .abs. Numeric. Contains absorbance values.

Examples


df <- data.frame(
  sample_type = rep(c("standard", "unknown"), each = 3),
  index = c(1, 1, 1, 2, 2, 2),
  .abs = c(1, 1, 1, 1, 1, 2)
)

qp_mark_outliers(df, ignore_outliers = "all")
#>   sample_type index .abs .is_outlier
#> 1    standard     1    1       FALSE
#> 2    standard     1    1       FALSE
#> 3    standard     1    1       FALSE
#> 4     unknown     2    1       FALSE
#> 5     unknown     2    1       FALSE
#> 6     unknown     2    2        TRUE
qp_mark_outliers(df, ignore_outliers = "standards")
#>   sample_type index .abs .is_outlier
#> 1    standard     1    1       FALSE
#> 2    standard     1    1       FALSE
#> 3    standard     1    1       FALSE
#> 4     unknown     2    1          NA
#> 5     unknown     2    1          NA
#> 6     unknown     2    2          NA
qp_mark_outliers(df, ignore_outliers = "samples")
#>   sample_type index .abs .is_outlier
#> 1    standard     1    1          NA
#> 2    standard     1    1          NA
#> 3    standard     1    1          NA
#> 4     unknown     2    1       FALSE
#> 5     unknown     2    1       FALSE
#> 6     unknown     2    2        TRUE
qp_mark_outliers(df, ignore_outliers = "none")
#>   sample_type index .abs .is_outlier
#> 1    standard     1    1          NA
#> 2    standard     1    1          NA
#> 3    standard     1    1          NA
#> 4     unknown     2    1          NA
#> 5     unknown     2    1          NA
#> 6     unknown     2    2          NA