is_proportion: Check if a Numeric Value is a Proportion

View source: R/utils-typechecks.R

is_proportionR Documentation

Check if a Numeric Value is a Proportion

Description

This function checks if a numeric value is a proportion scalar, meaning it is numeric and within the range of 0 to 1 (inclusive).

Usage

is_proportion(x)

Arguments

x

Numeric value to check.

Value

TRUE if x is a proportion, otherwise FALSE.

See Also

is_integerlike, is_count, validate_proportion, validate_count

Examples

is_proportion(0.5) # TRUE
is_proportion(1.2) # FALSE
is_proportion(-0.2) # FALSE

checkthat documentation built on Sept. 13, 2023, 1:06 a.m.