find_Outliers: Function to detect outliers in the roughness data

Description Usage Arguments Value Examples

View source: R/find_Outliers.R

Description

This function applies three different methods to detect outliers.

Usage

1
2
3
find_Outliers(data, prefilter = TRUE, method = c("iqr", "sd", "mad"),
  remove = "mad", window = FALSE, width = 20, step = 10,
  hist = TRUE, plot = TRUE, plot.single = FALSE, ...)

Arguments

data

data.frame (required): A log file imported with import_Data.

prefilter

logical (optional): TRUE to remove values that are +- 10 cm of the median

method

character (optional): Vector of methods applied to detect outliers. Currently implemented: "iqr" for Interquartile Range (see IQR), "sd" for Standard Deviation or "mad" for Median Absolut Deviation.

remove

character (optional): Returns the original data set with ourliers removed by the specified method (same options as for argument method).

window

logical (optional): If TRUE the data set is split in chunks of size specified by width before applying any of the detection methods.

width

integer (optional): Width of moving window.

step

integer (optional): Step size of moving window.

hist

logical (optional): Should histograms be plotted?

plot

logical (optional): Should the results be plotted?

plot.single

logical (optional): Should the plots be combined or individually presented?

...

Currently unused.

Value

The data set with outliers removed is returned. Optionally, a plot is created

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Load example data
file <- system.file("extdata/raw.log", package = "roughness")
data <- import_Data(file)

# find outliers
data_cleaned <- find_Outliers(data = data,
                              prefilter = TRUE,
                              method = c("iqr", "sd", "mad"),
                              remove = "mad",
                              window = FALSE,
                              width = 20,
                              step = 10, 
                              hist = TRUE,
                              plot = TRUE)

head(data_cleaned)

# find outliers with window technique
data_cleaned2 <- find_Outliers(data = data,
                               prefilter = TRUE,
                               method = "mad",
                               remove = "mad",
                               window = FALSE,
                               width = 30,
                               step = 15, 
                               hist = TRUE,
                               plot = TRUE)
                               
head(data_cleaned2)

tzerk/roughness documentation built on May 3, 2019, 2:05 p.m.