Skip to content

Setup gradethis

To use gradethis in your learnr tutorial, you only need to load the gradethis package. Still, you can use gradethis_setup() to change the default values of many of the exercise checking or grading function arguments.

Setup gradethis for use within learnr

Exercise Checking Functions

Choose one of these functions to use in the *-check chunk of your exercise.

Grade a student's submission using custom logic
Grade student code against a solution
Debug an exercise submission
.result .user .last_value .solution .solution_all .user_code .solution_code .solution_code_all .envir_prep .envir_result .evaluate_result .label .stage .engine
Checking environment objects for use in grade_this()

Signal A Final Grade

Helper functions to create and signal a final grade when used in custom checking logic in grade_this().

graded() pass() fail()
Signal a final grade for a student's submission
pass_if_equal() fail_if_equal()
Signal a passing or failing grade if two values are equal
pass_if() fail_if()
Signal a passing or failing grade if a condition is TRUE
Signal a failing grade if mistakes are detected in the submitted code
Fail if grading code produces an error

Generate Feedback Messages

Create feedback messages for use in graded() grades or in the exercise checking functions.

code_feedback() maybe_code_feedback() give_code_feedback()
Provide automated code feedback
random_praise() random_encouragement() give_praise() give_encouragement()
Random praise and encouragement
Inform the user about how gradethis interprets piped code

Helper Functions and Utilities

These functions are used by gradethis to work within learnr tutorials, or are available to help tutorial authors test their grading logic. Most users of gradethis will not need to use these functions.

A checker function to use with learnr
An error checking function for use with learnr
Mock a user submission to an exercise