grade_learnr: A checker function to use with 'learnr'

Description Usage Arguments Details Value Examples

View source: R/grade_learnr.R

Description

For exercise checking, learnr tutorials require a function that learnr can use in the background to run the code in each "-check" chunk and to format the results into a format that learnr can display. The function must accept a specific set of inputs and return a specific type of output (see graded()). Instructors are not intended to use the grade_learnr function directly, but to pass it to the exercise.checker knitr chunk option within the setup chunk of the learnr tutorial.

Usage

1
2
3
grade_learnr(label = NULL, solution_code = NULL, user_code = NULL,
  check_code = NULL, envir_result = NULL, evaluate_result = NULL,
  envir_prep = NULL, last_value = NULL, ...)

Arguments

label

Label for exercise chunk

solution_code

Code provided within the “-solution” chunk for the exercise.

user_code

R code submitted by the user

check_code

Code provided within the “-check” chunk for the exercise.

envir_result

The R environment after the execution of the chunk.

evaluate_result

The return value from the evaluate::evaluate function.

envir_prep

A copy of the R environment before the execution of the chunk.

last_value

The last value from evaluating the exercise.

...

Extra arguments supplied by learnr

Details

To enable exercise checking in your learnr tutorial, set tutorial_options(exercise.checker = grade_learnr) in the setup chunk of your tutorial.

Run gradethis_demo() to see an example learnr document that uses grade_learnr().

Value

An R list which contains several fields indicating the result of the check.

Examples

1
## Not run: gradethis_demo()

cgamboasanabria/gradethis documentation built on June 11, 2020, 12:15 a.m.