View source: R/utils-typechecks.R
validate_proportion | R Documentation |
This function validates whether a numeric value is a valid proportion scalar (ranging from 0 to 1, inclusive).
validate_proportion(x)
x |
Numeric value to validate as a proportion. |
TRUE
if x
is a valid proportion, otherwise it throws
an error.
is_proportion
, is_count
,
validate_count
, is_integerlike
validate_proportion(0.5) # TRUE
try(validate_proportion(1.2)) # Error
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.