Skip to content

Apply automatic grading to a problem object

Usage

tblcheck_grade(problem, max_diffs = 3, env = parent.frame(), ...)

# S3 method for default
tblcheck_grade(problem, max_diffs = 3, env = parent.frame(), ...)

# S3 method for list
tblcheck_grade(problem, max_diffs = 3, env = parent.frame(), ...)

# S3 method for tblcheck_problem
tblcheck_grade(problem, max_diffs = 3, env = parent.frame(), ...)

Arguments

problem

A problem generated by a tbl_check_*() function.

max_diffs

[numeric(1)]
The maximum number of mismatched values to display in an informative failure message. Passed to tbl_check_names() to determine the number of mismatched column names to display and the n_values argument of tbl_check_column() to determine the number of mismatched column values to display. Defaults to 3.

env

The environment used for grading.

...

Arguments passed on to gradethis::fail

hint

Include a code feedback hint with the failing message? This argument only applies to fail() and fail_if_equal() and the message is added using the default options of give_code_feedback() and maybe_code_feedback(). The default value of hint can be set using gradethis_setup() or the gradethis.fail.hint option.

encourage

Incude a random encouraging phrase with random_encouragement()? The default value of encourage can be set using gradethis_setup() or the gradethis.fail.encourage option.

Value

A gradethis::fail() message or NULL invisibly.

Examples

.result <- 1:10
.solution <- letters[1:10]
problem <- vec_check()
tblcheck_grade(problem)
#> <gradethis_graded: [Incorrect]
#>   Your result should be a vector of text (class `character`), but
#>   it is a vector of integers (class `integer`).
#> >