censorData1D: Helper function to censor data

Description Usage Arguments Value Examples

View source: R/utilities-data-validation.R

Description

Takes as input a numeric vector x of length n and replaces any values in x greater than max with max, and any values less than min with min

Usage

1
censorData1D(x, rng)

Arguments

x

Numeric vector of length n

rng

Range of values allowed in x, as a single (min, max) tuple

Value

numeric vector of length n equal to x except with any values in x larger than max replaced with max and any values in x smaller than min replaced with min.

Examples

1
2
censorData1D(1:7, (2,5))    #returns c(2,2,3,4,5,5,5)
censorData1D(c(1,9,7,3,0), (2,5))     #returns(c(2,5,5,3,2))

IQSS/PSI-Library documentation built on Feb. 15, 2020, 9:03 p.m.