Description Usage Arguments Details Value See Also Examples
View source: R/grade_conditions.R
Executes tests against the final result of the user code. If a test throws an error, the test fails and the submitted answer will be marked incorrect.
1 2 3 4 |
... |
ignored |
correct |
A character string to display if all tests pass. This character string will be run through glue::glue_data with:
|
incorrect |
A character string to display if at least one test fails.
This character string will be run through
|
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 |
Executes tests against the final result of the user code. If a test throws an error, the test fails and the submitted answer will be marked incorrect.
a grader_graded
structure from graded()
containing a formatted
correct
or incorrect
message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run: gradethis_demo()
example_function <- function(x){
return(x + 1)
}
grade_conditions(
pass_if(~ .result(3) == 4),
pass_if(~ .result(10) == 11),
grader_args = list(),
learnr_args = list(last_value = example_function, envir_prep = new.env())
)
grade_conditions(
pass_if(~ .result(3) == 4),
fail_if(~ .result(10) == 11),
grader_args = list(),
learnr_args = list(last_value = example_function, envir_prep = new.env())
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.