How to start with checkdown

George Moroz

2020-03-18

Instalation

Get the stable version from CRAN:

install.packages("checkdown")

… or get the development version from GitHub:

install.packages("devtools")
devtools::install_github("agricolamz/checkdown")

1. Demo

The main goal of this package to create checking fields and boxes in rmarkdown. It could be used in class, when teacher share materials and tasks, so student can solve some problems and check themselves. It is really important since some students are too shy to ask a question, so you can create tasks that will check on the fly the understanding of the class material and give some hints to those students that get stuck. In contrast with the learnr package the checkdown package works without shiny. Load the library:

library(checkdown)

1.1 Ask question with the check_question() function

Imagine that we want to create a checkbox with the answer 4. All you need is to create a following chunk with the chunck atribute results='asis' in your rmarkdown document:

check_question(answer =  4)

It is possible to change wrong and right answer’s messages using wrong and right arguments of the check_question() function. Let’s create some more questions.

Solve 3+3:

check_question(answer =  6, right = "correct", wrong = "not correct")

Type la-la:

check_question(answer =  "la-la")

Number of answers is not limited:

check_question(answer =  1:5)

It is also possible to create a list of answers for students to choose:

check_question("banana", options = c("apple", "banana", "bread"))

check_question("banana", options = c("apple", "banana", "bread"), type = "radio")



1.2 Give some hints with the check_hint() function

Sometimes you now in advance what kind of mistakes will your students do. Some students are shy and don’t like ask questions, so hints could partially solve this problem. Again all you need is to create a following chunk with the chunck atribute results='asis' in your rmarkdown document:

check_hint("You can use the rmarkdown package")

Click here to see/close the hint

Of course it is possible to change the message:

check_hint("You can use the rmarkdown package",
           click_text = "CLICK HERE")

CLICK HERE

It is possible to use Markdown inside messages:

check_hint("* You can use the **`rmarkdown` package**",
           click_text = "Click he`R`e")

Click heRe

check_question(answer =  4, 
               wrong = "a**R**e you su**R**e", 
               right = "### `R`ight")

2. Some important notes