library(learnr)
library(nycflights13)
options(tutorial.event_recorder = learnr:::debug_event_recorder)
tutorial_options(
  exercise.eval = FALSE, 
  exercise.checker = function(label, user_code, envir_result, ...)  {
    if (is.null(envir_result))
      list(message = "Bad code!",
           correct = FALSE)
    else
      list(message = "Nice job!", 
           correct = TRUE, 
           location = "append")
  },
  exercise.completion = TRUE,
  exercise.diagnostics = TRUE
)

Autocompletion Sandbox

autocompletion <- list(apple = 1, banana = 2, cherry = 3)
# Try typing here
# Try typing here
# no diagnostics here
# diagnostics here


rstudio/learnr documentation built on Sept. 6, 2024, 11:06 p.m.