grade_this()
allows instructors to determine a grade and to create custom
feedback messages using custom R code. To facilitate evaluating the
exercise, grade_this()
makes available a number of objects that can be
referenced within the { ... }
expression.
All of the objects provided by learnr
to an exercise checking function
are available for inspection. To avoid name collisions with user or
instructor code, the names of these objects all start with .
.
.label
: The exercise label.
.engine
: The exercise engine, typically 'r'.
.last_value
: The last value returned from evaluating the user's exercise submission.
.solution_code
: A string containing the code provided within the *-solution
chunk for the exercise.
.user_code
: A string containing the code submitted by the user.
.check_code
: A string containing the code provided within the *-check
or *-code-check
chunk for the exercise.
.envir_prep
: A copy of the R environment after running the exercise setup code and before the execution of the student's submitted code.
.envir_result
: The R environemnt after running the student's submitted code.
.evaluate_result
: The return value from the evaluate::evaluate()
function (see learnr's documentation).
In addition, gradethis has provided some extra objects:
.user
, .result
: The last value returned from evaluating the user's exercise submission.
.solution
: The last value returned from evaluating the .solution_code
for the exercise (evaluated in .envir_prep
).
.result .user .last_value .solution .user_code .solution_code .envir_prep .envir_result .evaluate_result .label .engine
An object of class .result
(inherits from gradethis_placeholder
) of length 0.
An object of class .user
(inherits from .result
, gradethis_placeholder
) of length 0.
An object of class .last_value
(inherits from .result
, gradethis_placeholder
) of length 0.
An object of class .solution
(inherits from gradethis_placeholder
) of length 0.
An object of class .user_code
(inherits from gradethis_placeholder
) of length 0.
An object of class .solution_code
(inherits from gradethis_placeholder
) of length 0.
An object of class .envir_prep
(inherits from gradethis_placeholder
) of length 0.
An object of class .envir_result
(inherits from gradethis_placeholder
) of length 0.
An object of class .evaluate_result
(inherits from gradethis_placeholder
) of length 0.
An object of class .label
(inherits from gradethis_placeholder
) of length 0.
An object of class .engine
(inherits from gradethis_placeholder
) of length 0.