Determine the floor and cap of a numeric variable by taking quantiles.
Using the quantiles, values in the data found to be lower or higher than
the floor or cap are replaced.
Usage
floor_and_cap(x, probs = c(0.025, 0.975))
Arguments
x
A vector that has length \(N\).
probs
A vector containing two values between 0 and 1, with the
first being less than the second.
# NOT RUN {# One case versionn = 100
x = rnorm(n)
x[n - 1] = -99999x[n] = 10000
y = floor_and_cap(x)
# Dataset example
d = data.frame(x, y = rnorm(n))
o = sapply(d, floor_and_cap)
# }