is_freq: Verify that input is a frequency (positive integer value).

Description Usage Arguments Value See Also Examples

View source: R/comp_util.R

Description

is_freq is a function that checks whether its single argument freq is a frequency (i.e., a positive numeric integer value).

Usage

1

Arguments

freq

A single (typically numeric) argument.

Value

A Boolean value: TRUE if freq is a frequency (positive integer), otherwise FALSE.

See Also

num contains basic numeric variables; init_num initializes basic numeric variables; prob contains current probability information; comp_prob computes current probability information; freq contains current frequency information; comp_freq computes current frequency information; is_valid_prob_set verifies the validity of probability inputs; as_pc displays a probability as a percentage; as_pb displays a percentage as probability

Other verification functions: is_complement, is_extreme_prob_set, is_perc, is_prob, is_suff_prob_set, is_valid_prob_pair, is_valid_prob_set, is_valid_prob_triple

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# ways to succeed:
is_freq(2)             # => TRUE, but does NOT return the frequency 2.
is_freq(1:3)           # => TRUE (for vector)

# ways to fail:
is_freq(-1)            # => FALSE + warning (negative values)
is_freq(1:-1)          # => FALSE (for vector) + warning (negative values)
is_freq(c(1, 1.5, 2))  # => FALSE (for vector) + warning (non-integer values)

## Note that:
is.integer(2)          # => FALSE!

riskyr documentation built on Feb. 19, 2018, 5 p.m.