Discard any values outside of range.

discard(x, range = c(0, 1))

Arguments

x

numeric vector of values to manipulate.

range

numeric vector of length two giving desired output range.

Examples

discard(c(-1, 0.5, 1, 2, NA))
#> [1] 0.5 1.0 NA