outliers: Detect and remove outliers

Description Usage Arguments See Also Examples

Description

Detect and remove outliers, as defined by quantile probabilities.

Usage

1
2
3
detect_outliers(x, probs, na.rm = FALSE, incbounds = TRUE)

rm_outliers(df, ..., probs = c(0.025, 0.975), na.rm = FALSE, incbounds = TRUE)

Arguments

x

a numeric vector.

probs

for detect_outliers(), a length-2 numeric vector of probabilities. For rm_outliers(), the same or a list of such vectors. See quantile.

na.rm

logical, whether to remove NA values before computing quantiles.

incbounds

logical, whether boundary values should be interpreted as inclusive. See between.

df

a data.frame.

...

quoted column names in which to search for outliers, or a vector of column names.

See Also

quantile and between.

Examples

1
2
3
4
5
6
7
df <- data.frame(num1 = 1:1e3, num2 = sample(1:1e3))

df$num1[detect_outliers(df$num1, probs = c(0.025, 0.975))]

identical(rm_outliers(df, c("num1", "num2")),
          rm_outliers(df, "num1", "num2")
          )

coletl/coler documentation built on May 12, 2021, 9:44 p.m.