is_binary_vector: Checks if a vector contains only binary values (0 or 1)

View source: R/integer_vector.R

is_binary_vectorR Documentation

Checks if a vector contains only binary values (0 or 1)

Description

Checks if a vector contains only binary values (0 or 1)

Usage

is_binary_vector(
  v,
  allow_na_values = FALSE,
  allow_degenerate = NULL,
  allow_uniform = TRUE
)

Arguments

v

the vector

allow_na_values

if the vector can contain NA values. Default FALSE

allow_degenerate

deprecated. Use allow_uniform.

allow_uniform

if TRUE (the default), the vector is allowed to contain

Examples

## Not run: 
# For assertion.
# Will fail if v contains any value that is not either 0 or 1
assertthat::assert_that(qscheck::is_binary_vector(v))
# For check
if (qscheck::is_binary_vector(v)) {}

## End(Not run)


AstraZeneca/qscheck documentation built on Nov. 1, 2023, 4:45 a.m.