trunc_range: Truncates a values to lower and/or upper bounds

Description Usage Arguments Examples

View source: R/robust_z.R

Description

Truncates a values to lower and/or upper bounds

Usage

1
2
3
4
5
6
7
8
trunc_range(
  x,
  low = NA,
  high = NA,
  filter = FALSE,
  low.val = NA,
  high.val = NA
)

Arguments

x

input vector/matrix of values

low

lower limit to truncate to

high

upper limit to truncate to

filter

if codeTRUE filters out truncated values, otherwise replace them

low.val

an alternate value to replace the lower limit with, rather than the lower limit itself

high.val

an alternate value to replace the upper limit with, rather than the upper limit itself

Examples

1
2
3
4
x <- rnorm(500, mean=0, sd=5)
low.val/high.val is useful for differentiating truncated values on a plot
x1 <- trunc_range(x, low=-5, high=5, low.val=-6, high.val=6)
plot(x1 ~ x)

mkumar-rapttx/RAPTR documentation built on July 3, 2021, 10:14 p.m.