Description Usage Arguments Examples
This function capps the lowest and highest values of a numeric vector between specified values. It can be used both with numeric vectors or data frames with mutate or map_at. If no floor and roof values are provided the function will return exactly the same result as input values.
1 | cap_between(x, floor = NA, roof = NA)
|
x |
A vector or data frame column |
floor |
A bottom number. Defaults to NA |
roof |
A top number. Defaults to NA |
1 2 3 4 5 6 7 | x <- seq(1, 100, 1)
cap_between(x, 40, 60)
data <- data_frame(x = seq(1, 100, 1))
data %>%
mutate(y = cap_between(x, 40, 60))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.