Learn R Programming

simtrial (version 1.0.0)

check_args: Check argument types, length, or dimension

Description

Check argument types, length, or dimension

Usage

check_args(arg, type, length = NULL, dim = NULL)

Value

Check failure detailed error message.

Arguments

arg

An argument to be checked.

type

A character vector of candidate argument type.

length

A numeric value of argument length or NULL.

dim

A numeric vector of argument dimension or NULL.

Specification

The contents of this section are shown in PDF user manual only.

Details

If type, length or dim is NULL, the corresponding check will not be executed.

Examples

Run this code
if (FALSE) {
tbl <- as.data.frame(matrix(1:9, nrow = 3))
simtrial:::check_args(arg = tbl, type = c("data.frame"))

vec <- c("a", "b", "c")
simtrial:::check_args(arg = vec, type = c("character"), length = 3)
}

Run the code above in your browser using DataLab