r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
498 stars 136 forks source link

`check_whole_number()` closed interval messaging #1591

Closed teunbrand closed 1 year ago

teunbrand commented 1 year ago

Hi rlang team,

I think it would be great if during a check for nonzero positive integers, the output of check_number_whole(0, min = 1) would not be:

! `0` must be a number larger than 1, not the number 0.

and instead could read:

`0` must be a whole number larger than or equal to 1, not the number 0

In particular, I'd like to confer that 1 is included in the interval. It would also be nice to message that these should be integers/whole numbers.

Please let me know if you'd welcome a PR for this.

lionel- commented 1 year ago

A PR would be nice but this might be a bit tricky.