Description Usage Arguments Examples
Checking fill-in-the-blanks problems
1 | check_blanks(ex, pat, ...)
|
ex |
the expression to check, e.g. USER_CODE |
pat |
the anticipated correct form. Use elements such as |
... |
tests to apply to expressions in |
1 2 3 4 5 6 7 8 9 10 | submission <- for_checkr(quote({a <- 3; b <- 4; res <- sqrt(a^2 + b^2)}))
submission2 <- for_checkr(quote({a <- 3; b <- 4; res <- sin(a^2 + b^2)}))
# a template with a blank ..fn..
as_posted <- quote(res <- ..fn..(a^2 + b^2))
check_blanks(submission, !!as_posted,
insist(fn == quote(sqrt), "{{fn}} is not the right function."))
check_blanks(submission2, !!as_posted,
insist(fn == quote(sqrt), "{{fn}} is not the right function."))
# Multiple blanks
as_posted <- for_checkr(quote({res <- ..fn..(`+`(`^`(a, ..exp1..), `^`(b, ..exp2..)))}))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.