View source: R/utils-typechecks.R
validate_count | R Documentation |
This function validates whether a numeric value is a valid count (integer of zero or greater).
validate_count(x, include_zero = TRUE)
x |
Numeric value to validate as a count. |
include_zero |
Logical, whether to include zero as a valid count. |
TRUE
if x
is a valid count, otherwise it throws an
error.
is_count
, is_proportion
,
validate_proportion
, is_integerlike
validate_count(0) # TRUE
validate_count(3) # TRUE
try(validate_count(0, include_zero = FALSE)) # Error: Not a valid count
try(validate_count(-1)) # Error: Not a valid count value.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.