Examples for 'scales::oob'


Out of bounds handling

Aliases: oob oob_censor oob_censor_any oob_discard oob_squish oob_squish_any oob_squish_infinite oob_keep censor discard squish squish_infinite

Keywords:

### ** Examples

# Censoring replaces out of bounds values with NAs
oob_censor(c(-Inf, -1, 0.5, 1, 2, NA, Inf))
[1] -Inf   NA  0.5  1.0   NA   NA  Inf
oob_censor_any(c(-Inf, -1, 0.5, 1, 2, NA, Inf))
[1]  NA  NA 0.5 1.0  NA  NA  NA
# Squishing replaces out of bounds values with the nearest range limit
oob_squish(c(-Inf, -1, 0.5, 1, 2, NA, Inf))
[1] -Inf  0.0  0.5  1.0  1.0   NA  Inf
oob_squish_any(c(-Inf, -1, 0.5, 1, 2, NA, Inf))
[1] 0.0 0.0 0.5 1.0 1.0  NA 1.0
oob_squish_infinite(c(-Inf, -1, 0.5, 1, 2, NA, Inf))
[1]  0.0 -1.0  0.5  1.0  2.0   NA  1.0
# Keeping does not alter values
oob_keep(c(-Inf, -1, 0.5, 1, 2, NA, Inf))
[1] -Inf -1.0  0.5  1.0  2.0   NA  Inf
# Discarding will remove out of bounds values
oob_discard(c(-Inf, -1, 0.5, 1, 2, NA, Inf))
[1] 0.5 1.0  NA

[Package scales version 1.2.0 Index]