Description Usage Arguments Details Value Examples
remove_outliers function
1 | remove_outliers(.data, vars = NULL, approx = FALSE)
|
.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. |
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.
resulting data.frame or a vector if source dataset contain only one column
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.