mark_outlier_rows: Mark outlier rows.

View source: R/mark_outlier_rows.R

mark_outlier_rowsR Documentation

Mark outlier rows.

Description

mark_outlier_rows drops outlier rows.

Usage

mark_outlier_rows(
  population,
  variables,
  sample,
  method = "svd+iqr",
  outlier_col = "is_outlier",
  ...
)

Arguments

population

tbl with grouping (metadata) and observation variables.

variables

character vector specifying observation variables.

sample

tbl containing sample that is used by outlier removal methods to estimate parameters. sample has same structure as population. Typically, sample corresponds to controls in the experiment.

method

optional character string specifying method for outlier removal. There is currently only one option ("svd_iqr").

outlier_col

optional character string specifying the name for the column that will indicate outliers (in the output). Default "is_outlier".

...

arguments passed to outlier removal method.

Value

population with an extra column is_outlier.

Examples

suppressMessages(suppressWarnings(library(magrittr)))
population <- tibble::tibble(
  Metadata_group = sample(c("a", "b"), 100, replace = TRUE),
  Metadata_type = sample(c("control", "trt"), 100, replace = TRUE),
  AreaShape_Area = c(rnorm(98), 20, 30),
  AreaShape_Eccentricity = rnorm(100)
)
variables <- c("AreaShape_Area", "AreaShape_Eccentricity")
sample <- population %>% dplyr::filter(Metadata_type == "control")
population_marked <-
  cytominer::mark_outlier_rows(
    population,
    variables,
    sample,
    method = "svd+iqr"
  )
population_marked %>%
  dplyr::group_by(is_outlier) %>%
  dplyr::sample_n(3)

CellProfiler/cytominr documentation built on July 2, 2023, 6:19 p.m.