validate_proportion {checkthat} | R Documentation |
Validate a Proportion Value
Description
This function validates whether a numeric value is a valid proportion scalar (ranging from 0 to 1, inclusive).
Usage
validate_proportion(x)
Arguments
x |
Numeric value to validate as a proportion. |
Value
TRUE
if x
is a valid proportion, otherwise it throws
an error.
See Also
is_proportion
, is_count
,
validate_count
, is_integerlike
Examples
validate_proportion(0.5) # TRUE
try(validate_proportion(1.2)) # Error
[Package checkthat version 0.1.0 Index]