rm_outlier: Remove Outlier

View source: R/helpful_functions.R

rm_outlierR Documentation

Remove Outlier

Description

This function removes outlier from a vector or replaced outliers by NA. According to box plots the function defines outliers as 1.5 x IQR. Caution: NAs already present in the input vector will be removed first.

Usage

rm_outlier(x, fill_na = F)

Arguments

x

numeric vector

fill_na

logical; If TRUE all outliers present in x will be replaced by NA. If FALSE all outliers will be deleted.

Value

numeric vector; without outliers or outliers replaced by NA

Examples

# get some example vector
root_norm <- norm_10mm_standard(root_output)
x <- root_norm[root_norm$Label == "weitar1_1;28", ]$LengthMM

# delete outliers
rm_outlier(x, fill_na = FALSE)

# replace outliers with NA
rm_outlier(x, fill_na = TRUE)

PhilippJanitza/rootdetectR documentation built on Feb. 24, 2024, 6:46 a.m.