problem: Declare a problem

View source: R/problem.R

problemR Documentation

Declare a problem

Description

Useful for constructing a small list to communicate the problem that was discovered during checking.

Usage

problem(
  type,
  expected,
  actual,
  ...,
  .class = c(paste0(type, "_problem"), "tblcheck_problem")
)

Arguments

type

A character string, e.g. column_values or table_rows, that describes the problem that was discovered.

expected, actual

The expected and actual values. These should be included when the value is a summary, e.g. nrow(expected) or length(actual). Be careful not to include large amounts of data.

...

Additional elements to be included in the problem object.

.class

The class of the problem. Typically, we expect the problem class to be <type>_problem, but if you are building custom classes you may set these classes as desired.

Value

Returns a problem with class <type>_problem and the base classes tblcheck_problem and gradethis_problem.

See Also

Other Problem functions: problem_grade(), problem_message(), problem_type()

Examples

problem(
	type = "class",
	expected = "character",
	actual = "numeric",
	expected_length = 1,
	actual_length = 2
)


rstudio/tblcheck documentation built on March 11, 2023, 5:42 p.m.