It runs both the solution and the student submission, and populates the state with parse data, output, etc. After running this function, the state is available thorugh ex, from which you can start your SCT chains. In a way, this function is a very light weight version of DataCamp's R Backend.

setup_state(sol_code = "", stu_code = "", sol_env = NULL,
  stu_env = NULL, stu_result = NULL, pec = character(),
  ex_type = "NormalExercise", force_diagnose = FALSE)

Arguments

sol_code

Solution script as a string. If it is not specified, the student code will be used.

stu_code

Student submission as a string. If it is not specified, the solution code will be used.

sol_env

Solution environment. If this is specified, the solution code is not rerun.

stu_env

Student environment. If this is specified, the student code is not rerun.

stu_result

Result of calling evaluate on the student code. If this is is specified, this overrides the output generated by running stu_code.

pec

Pre-exercise-code as a string

ex_type

Type of exercise as a string. Defaults to NormalExercise.

force_diagnose

whether diagnose tests have to pass even if the checks pass (FALSE by default)

Value

The exercise state, from which you can start chaining.

Note

This function is only supposed to be used locally when experimenting. It should never be used in the eventual SCT script of an exercise.

Examples

if (FALSE) { setup_state( sol_code = "a <- 1", stu_code = "a <- 2" ) ex() %>% check_object('a') %>% check_equal() }