Winsorize or trim variables

winsorize(X, bounds, trim = FALSE)

Arguments

X

numeric: vector to be winsorized or trimmed

bounds

double: vector of winsorizing minimum and maximum bounds, c(min percentile, max percentile)

trim

boolean: if TRUE then replace outliers with NA instead of winsorizing bound

Value

numeric vector of winsorized or trimmed values