indicate_outliers: Creates new columns to indicate which values are outliers...

View source: R/outliers.R

indicate_outliersR Documentation

Creates new columns to indicate which values are outliers based on the average value.

Description

Creates new columns to indicate which values are outliers based on the average value.

Usage

indicate_outliers(
  data,
  select_columns = NULL,
  group_variable,
  std_dev_value = 1.96,
  zero_is_outlier = FALSE
)

Arguments

data

A data.frame

select_columns

A string or vector of strings with the name(s) of the numeric columns to check for outliers. If NULL (default), will use all numeric columns in the data.

group_variable

A string with the name of the column with the grouping variable.

std_dev_value

A number indicating how many standard deviations away from the mean to determine if a value is an outlier.

zero_is_outlier

If TRUE (not default), reports any zero value as an outlier.

Value

The initial data.frame with new columns for each numeric variable included with a value of 0 if not an outlier and 1 if that row is an outlier.

Examples

indicate_outliers(mtcars, "drat", group_variable = "am")
indicate_outliers(mtcars, "drat", group_variable = "am", zero_is_outlier = TRUE)

jacobkap/crime documentation built on Jan. 10, 2023, 8:19 a.m.