is_string_vector: Checks if the passed entity is a vector of strings...

View source: R/string_vector.R

is_string_vectorR Documentation

Checks if the passed entity is a vector of strings (character). Note that in R single values are also vectors.

Description

Checks if the passed entity is a vector of strings (character). Note that in R single values are also vectors.

Usage

is_string_vector(
  value,
  exact_length = NULL,
  min_length = NULL,
  max_length = NULL,
  allow_na_values = FALSE,
  allow_null = FALSE
)

Arguments

value

The value to check

exact_length

integer. If passed, checks if the vector is of the *exact* specified length.

min_length

integer. If passed, checks if the vector length is at least the specified length, inclusive. Note: if exact_length is specified, this parameter is ignored

max_length

integer. If passed, checks if the vector length is at most the specified length, inclusive Note: if exact_length is specified, this parameter is ignored

allow_na_values

boolean. If passed allows vectors containing NAs. The length check is performed including the NA values. Default FALSE.

allow_null

boolean. If TRUE, also accepts a value of NULL. Default FALSE.

Examples

## Not run: 
# For assertion
assertthat::assert_that(qscheck::is_string_vector(my_parameter))
# For check
if (qscheck::is_string_vector(my_parameter)) {}

## End(Not run)


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