Description Usage Arguments Value Examples
'code_calls()' is designed to be used in a magrittr pipe. It will first check whether the code input has a;lready failed a previous check. If it has not, 'code_calls()' will check to see whether the code calls the given object or function.
1 2 |
submission |
The code to check, as a character string, or the output of a previous check function. If you are using 'code_calls()' within a tutor document, set code to the special name '.answer'. |
call |
The name of a function or object to check for as a character string. |
message |
A character string of feedback to display if the code fails the check |
warn |
'TRUE' or 'FALSE': should grading continue if condition is unmet? If 'TRUE', 'code_calls()' will mark the submission as a warning and pass the submission to the next check in the checking pipe. In this case, 'code_calls()' will append the message to the list of messages to be displayed when checking completes. |
praise |
A character string of feedback to display if the code passes the check. If a submission receives more than one praise. When checking finishes, magrader will display all of the warnings and praises that have accumulated for a submission. |
If the code passes the check, 'code_calls()' returns the original code. If the code fails the check, 'code_calls()' returns a failure object that contains a feedback message.
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
"head(mtcars)" %>%
code_calls("head") %>%
code_calls("mpg", "oops, wrong data set.")
# If in a tutor document
.answer %>%
code_calls("head") %>%
code_calls("mpg", "oops, wrong data set.")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.