Learn R Programming

chk (version 0.10.0)

check_length: Check Length

Description

Checks length of an object.

Usage

check_length(x, values = numeric(0), x_name = NULL)

Value

An informative error if the test fails or an invisible copy of x.

Arguments

x

The object to check.

values

A flag or a whole numeric vector of the value, value range or possible values.

x_name

A string of the name of object x or NULL.

See Also

Other check: check_data(), check_dim(), check_dirs(), check_files(), check_key(), check_names(), check_values()

Examples

Run this code
check_length(1)
try(check_length(1, values = FALSE))
try(check_length(1, values = c(10, 2)))

Run the code above in your browser using DataLab