remove_outliers: Statistical data analysis support functions Sergey "kol"...

Description Usage Arguments Details Value Examples

View source: R/rmout.R

Description

remove_outliers function

Usage

1
remove_outliers(.data, vars = NULL, approx = FALSE)

Arguments

.data

dataset (data.frame)

vars

variables to inspect (character string, formula or vector). If omitted, all numeric columns are processed. If a single variable is provided and approx is TRUE, outlier values are removed from dataset. If it is a vector, data is not removed but replaced with NAs.

approx

If TRUE, outliers are approximated using gam() function, if FALSE (default) - removed or replaced by NAs.

Details

Remove outliers

The function takes a dataset, checks that given variables for outliers and either removes them or approximate using other data in these variables.

Value

resulting data.frame or a vector if source dataset contain only one column

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
d <- data.frame(
  id = c("1","2","3","4","5"),
  a = c(1,2,10,1000,100),
  b = c(19999, 30000000, 1, 5, 426798))
remove_outliers(d, ~a)
remove_outliers(d)

## End(Not run)

skolchin/statp documentation built on April 21, 2020, 2:08 a.m.