Uses the assertr::within_n_mads()
.
chk_outliers(.data, .n_mads, .variables)
Data to audit.
Number of mean absolute deviations (see assertr::within_n_mads).
Column variables to check.
Adds attribute that contains the audit errors, if any, to the data.
Use aud_report()
to view the audit fails.
library(magrittr)
ds <- data.frame(a = c(rnorm(100), 10))
flaws <- ds %>%
chk_outliers(2, "a")
aud_report(flaws)
#> Column Fails Values RowNum
#> 1 a 2 3.15382394929365, 10 73, 101