check_for_learnr: Interface for checking learnr exercises.

Description Usage Arguments Examples

View source: R/check_for_learnr.R

Description

This is the interface from learnr to checkr. You don't call this function directly: that will be done by learnr. Instead, you have to tell learnr to use this function. Do this with a directive in the setup chunk of the learnr document: tutorial_options(exercise.checker = checkr2::check_for_learnr)

Usage

1
2
3
check_for_learnr(label = NULL, user_code = NULL, solution_code = NULL,
  check_code = NULL, envir_result = NULL, evaluate_result = NULL, ...,
  debug = FALSE)

Arguments

label

argument passed by learnr system

user_code

ditto

solution_code

ditto

check_code

ditto

envir_result

ditto

evaluate_result

ditto

...

ditto

debug

development flag to turn on logging of the information sent by learnr. This must be set at compile time, it's not for users.

Examples

1
2
3
4
5
6
7
8
# as it would be called from the learnr system ...
check_for_learnr(envir_result = 3, label = "first", user_code = "sin(pi)",
  check_code = 'ex <- for_checkr(USER_CODE)
                t1 <- line_where(ex, F == sin, message="Please use the sin function.")
                a1 <- arg_number(t1, 1); check(a1, passif(V == pi, "Right-oh!"))'
)

#'

dtkaplan/checkr2 documentation built on May 17, 2019, 4:01 p.m.