Description Usage Arguments Examples

Check whether a value within a certain interval

1 2 3 4 5 6 7 | ```
is_bounded(
x,
lower_bound = -Inf,
lower_closed = FALSE,
upper_bound = Inf,
upper_closed = FALSE
)
``` |

`x` |
A value to be tested |

`lower_bound` |
The lower bound |

`lower_closed` |
Whether the lower bound is closed |

`upper_bound` |
The upper bound |

`upper_closed` |
Whether the upper bound is closed |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ```
## Not run:
library(assertthat)
assert_that(is_bounded(10))
# TRUE
assert_that(is_bounded(10:30))
# TRUE
assert_that(is_bounded(Inf))
# Error: Inf is not bounded by (-Inf,Inf)
assert_that(is_bounded(10, lower_bound = 20))
# Error: 10 is not bounded by (20,Inf)
assert_that(is_bounded(
10,
lower_bound = 20,
lower_closed = TRUE,
upper_bound = 30,
upper_closed = FALSE
))
# Error: 10 is not bounded by [20,30)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.