exclExtrValues {wrMisc} | R Documentation |
Exclude extreme values (based on distance to mean)
Description
This function aims to identify extreme values (values most distant to mean, thus potential outlyers), mark them as NA or directely exclude them (depending on 'showNAs
').
Note that every set of non-identical values will have at least one most extreme value. Extreme values are part of many distributions, they are not necessarily true outliers.
Usage
exclExtrValues(
dat,
result = "val",
CVlim = NULL,
maxExcl = 1,
showNA = FALSE,
goodValues = TRUE,
silent = FALSE,
callFrom = NULL
)
Arguments
dat |
numeric vector, main input |
result |
(character) may be 'val' for returning data without extreme values or 'pos' for returning position/index of extreme values |
CVlim |
(NULL or numeric) allows to retain extreme values only if a certain CV (for all 'dat') is exceeded (to avoid calling extreme values form homogenous data-sets) |
maxExcl |
(integer) max number of elments to explude |
showNA |
(logical) will display extrelme values as NA |
goodValues |
(logical) allows to display rather the good values instead of the extreme values |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of message(s) produced |
Value
numeric vector wo extremle values or index-position of extreme values
See Also
firstOfRepLines
, get1stOfRepeatedByCol
for treatment of matrix
Examples
x <- c(rnorm(30),-6,20)
exclExtrValues(x)