Compute trimming values and trim data to a specified range
compute_trim_values.Rd
Compute trimming values and trim data to a specified range
Usage
compute_trim_values(
x,
centered = FALSE,
trim_prop = NULL,
trim_range = NULL,
ceiling = FALSE
)
apply_trim_values(
x,
centered = FALSE,
trim_values = NULL,
trim_prop = NULL,
trim_range = NULL,
ceiling = FALSE
)
Arguments
- x
Vector or matrix of continuous values that should be trimmed.
- centered
Logical. If the data is z-score scaled, the trimming ranges are made symmetric. Default value FALSE.
- trim_values
Vector of length two defining the upper and lower limits, respectively. If NULL, trim_prop or trim_range must be specified to derive the trim_values using compute_trim_values.
Value
Vector of length two with data range that should be used for trimming.
Vector or matrix where the values outside the specified range are squished.
Examples
set.seed(123)
x <- rnorm(10)
x
#> [1] -0.56047565 -0.23017749 1.55870831 0.07050839 0.12928774 1.71506499
#> [7] 0.46091621 -1.26506123 -0.68685285 -0.44566197
apply_trim_values(x, trim_values = 1)
#> [1] 1.000000 1.000000 1.558708 1.000000 1.000000 1.715065 1.000000 1.000000
#> [9] 1.000000 1.000000