library(learnr)
library(submitr)
library(basket)
library(etude)
library(gradethis)
knitr::opts_chunk$set(echo = FALSE)
learnr::tutorial_options(
  exercise.timelimit = 60, 
  exercise.checker = #gradethis::grade_learnr) 
  submitr::null_code_checker)
submitr::login_controls()
options(tutorial.storage = "none")
vfun <- make_basic_validator(NULL, "hello") #basket::check_valid
storage_actions <- record_local("./minimal_submissions.csv")
submitr::shiny_logic(input, output, session, vfun,
                     storage_actions)

Fixed-response questions

learnr::question("Which planet do we live on?",
         answer("Mars", correct=FALSE),
         answer("Earth", correct = TRUE,  message = "Good job Earthling!"),
         answer("Saturn",  correct = FALSE),
         allow_retry = TRUE,
         random_answer_order = TRUE
)

Essay

etude::essay_response(
  prompt = "Write your thoughts here"
)

Video

Just a link

Graded Code


gradethis::grade_result(
  fail_if( ~ .result != 3, "Result should have been 3."),
  pass_if(~ TRUE, "Good for you!"),
  glue_correct = "{.message}"
)

Ungraded Code


Multiple selections in multiple choice

learnr::question("Which of these are countries?",
         answer("California", correct=FALSE),
         answer("France", correct = TRUE,  message = "Good job Earthling!"),
         answer("China",  correct = TRUE),
         random_answer_order = FALSE,
         options = list(foobar = "Flag")
)


dtkaplan/submitr documentation built on Sept. 20, 2020, 1:19 a.m.