is_proportion {checkthat}R 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

[Package checkthat version 0.1.0 Index]