dot-cleanVectorArgs: Validate arguments provided as vectors

.cleanVectorArgsR Documentation

Validate arguments provided as vectors

Description

Validate arguments provided as vectors

Usage

.cleanVectorArgs(arg = NULL, expectedLength = NULL, type)

Arguments

expectedLength

An integer to denote the expected length of the vector.

type

A single string or a vector of string representation or class of the type that should be checked for.

x

A vector of arguments.

Details

Cleaning an argument provided as (atomic or generic) vector involves:

  • Checking that it is of expected length.

  • Checking for NULL or other special constants (NaN, Inf, NA of the wrong type) and standardizing them to NA of desired data type.

  • Checking that each element in the vector is of expected data type.

  • Making sure that an atomic vector is always returned, irrespective of if the input was a list or an atomic vector.

Value

An atomic vector of desired data type.

Examples

ospsuite:::.cleanVectorArgs(list(1, 2, NA, NULL), 4L, "numeric")

Open-Systems-Pharmacology/OSPSuite-R documentation built on April 28, 2024, 2:24 a.m.