check_data_frame: Check argument type (data frame)

View source: R/type-check-tabular.R

check_data_frameR Documentation

Check argument type (data frame)

Description

[Experimental]

Checks that an argument is a data frame, producing a friendly error message on failure.

Usage

check_data_frame(
  x,
  ...,
  allow_null = FALSE,
  arg = caller_arg(x),
  call = caller_env()
)

Arguments

x

The argument to check.

...

Additional arguments passed to abort().

allow_null

Whether NULL is allowed.

arg

An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

Value

NULL invisibly if the check passes, throws an error otherwise.

See Also

Other input checkers: check_type_number, check_type_scalar, stop_input_type()

Examples

check_data_frame(mtcars)

try(check_data_frame(1:5))

rlang documentation built on April 6, 2026, 5:07 p.m.