problem_type: Problem helper functions

View source: R/problem.R

problem_typeR Documentation

Problem helper functions

Description

  • problem_type() returns a problem's type, or NULL if the input is not a problem.

  • is_problem() tests whether an object is a gradethis problem.

  • is_tblcheck_problem() tests whether an object is a problem created by tblcheck.

  • as_problem() converts a list to a tblcheck_problem.

Usage

problem_type(x)

is_problem(x, type = NULL)

is_tblcheck_problem(x, type = NULL)

as_problem(x)

Arguments

x

An object

type

[character(1)]
A problem type

Details

If type is specified, is_problem() and is_tblcheck_problem() test whether an object is a problem of the specified type.

Value

is_problem() and is_tblcheck_problem() return a logical of length 1. problem_type() returns a character of length 1. as_problem() returns a tblcheck_problem.

See Also

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

Examples

problem_type(vec_check(1, "1"))
is_problem(vec_check(1, "1"), "vector_class")
is_tblcheck_problem(vec_check(1, "1"), "class")


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