Description Usage Arguments Value See Also Examples
Compares the final result of the student code to known pass_if()
and
fail_if()
condition()
s. If the student result exactly matches a known
case, returns the matching message value.
1 2 3 4 |
... |
|
correct |
A character string to display if the student answer matches a known correct answer. |
incorrect |
A character string to display if the student answer matches a known incorrect answer. |
grader_args |
A list of parameters passed to
|
learnr_args |
A list of all parameters passed to |
glue_correct |
A glue string that returns the final correct message
displayed. Defaults to |
glue_incorrect |
A glue string that returns the final incorrect message
displayed. Defaults to |
a graded()
object from either pass_if()
or fail_if()
containing
a formatted correct
or incorrect
message and whether or not a match was
found.
grade_code()
, grade_result()
, and grade_conditions()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run: gradethis_demo()
grade_result(
pass_if(~ identical(.result, 5), "This is a correct message"),
grader_args = list(),
learnr_args = list(last_value = 5, envir_prep = new.env())
)
grade_result(
pass_if(function(x) identical(x, 5), "This is a correct message"),
learnr_args = list(last_value = 5)
)
grade_result(
pass_if(5, "This is a correct message"),
learnr_args = list(last_value = 5)
)
grade_result(
fail_if(5, "You were supposed to do this other thing!"),
pass_if(~ TRUE, "should never reach here"),
learnr_args = list(last_value = 5)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.