Learn R Programming

arkhe (version 1.10.0)

assert_type: Check Data Types

Description

Check Data Types

Usage

assert_type(x, expected, allow_empty = TRUE, allow_null = FALSE)

assert_scalar(x, expected)

assert_function(x)

Value

Throws an error, if any, and returns x invisibly otherwise.

Arguments

x

An object to be checked.

expected

A character string specifying the expected type. It must be one of "list", "atomic", "vector", "numeric", "integer", "double", "character" or "logical".

allow_empty

A logical scalar: should empty object be allowed?

allow_null

A logical scalar: should NULL object be ignored?

Author

N. Frerebeau

See Also

Other checking methods: assert_constant(), assert_dim(), assert_empty(), assert_infinite(), assert_length(), assert_lower(), assert_missing(), assert_names(), assert_numeric, assert_package(), assert_square(), assert_unique()