Description Usage Arguments Value Examples
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.
1 | floor_and_cap(x, probs = c(0.025, 0.975))
|
x |
A |
probs |
A |
A vector
with the values floored and capped.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # One case version
n = 100
x = rnorm(n)
x[n - 1] = -99999
x[n] = 10000
y = floor_and_cap(x)
# Dataset example
d = data.frame(x, y = rnorm(n))
o = sapply(d, floor_and_cap)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.