library(learnr)
library(etude)
library(gradethis)
learnr::tutorial_options(exercise.timelimit = 60,
                 exercise.checker = gradethis::grade_learnr)
knitr::opts_chunk$set(echo = FALSE)

learnrhash is a system that performs the submission of student answers to a {learnr} document, but has the student submit their answers through a course support system or Google form. Thus, the instructor only has to set up the place to accepts the hashes.

There are additional advantages to this approach, for example avoiding the need to set up any student accounts beyond those of the learning support system or, in the case of Google Forms, providing security via a Google login (for a form that requires the email be collected automatically).

I want to see how it works and the extent to which it plays well with {submitr}.

Questions

etudeQA()

etude::choose_one(
  prompt = "Which of these letters is a vowel?",
  choices = list(
    "+A+" = "",
    "B" = "B's a consonant, Bub.",
    "C" = "C is a consonant, Chub",
    "D" = "D is a consonant, Dear",
    "+E+" = ""
  )
)

Submit

learnrhash::encoder_logic()
learnrhash::encoder_ui()

Topic 1

Exercise

Here's a simple exercise with an empty code chunk provided for entering the answer.

Write the R code required to add two plus two:


grade_result( 
  pass_if(~ .result == 4, "Fabulous"),
  fail_if(~ TRUE, "Not so good")
)

Exercise with Code

Here's an exercise with some prepopulated code as well as exercise.lines = 5 to provide a bit more initial room to work.

Now write a function that adds any two numbers and then call it:

add <- function() {

}

Topic 2

Exercise with Hint

Here's an exercise where the chunk is pre-evaulated via the exercise.eval option (so the user can see the default output we'd like them to customize). We also add a "hint" to the correct solution via the chunk immediate below labeled print-limit-hint.

Modify the following code to limit the number of rows printed to 5:

mtcars
head(mtcars)

Quiz

You can include any number of single or multiple choice questions as a quiz. Use the question function to define a question and the quiz function for grouping multiple questions together.

Some questions to verify that you understand the purposes of various base and recommended R packages:

quiz(
  question("Which package contains functions for installing other R packages?",
    answer("base"),
    answer("tools"),
    answer("utils", correct = TRUE),
    answer("codetools")
  ),
  question("Which of the R packages listed below are used to create plots?",
    answer("lattice", correct = TRUE),
    answer("tools"),
    answer("stats"),
    answer("grid", correct = TRUE)
  )
)


dtkaplan/mosaicUSAFA documentation built on Aug. 21, 2021, 10:37 p.m.