knitr::opts_chunk$set(echo = TRUE)
More than one hint possible.
Only one hint possible.
gradethis::grade_result( pass_if(~ identical(.result, correct_result), "message"), fail_if(~ identical(.result, wrong_result), "message") )
# every pass_if condition must be satisfied gradethis::grade_result_strict( pass_if(~ identical(.result, correct_result), "message"), fail_if(~ identical(.result, wrong_result), "message") )
Or add , exercise.reveal_solution = FALSE
to the solution chunk options:
"replace this by the correct code (pipe as one line)"
gradethis::grade_code( correct = "message", incorrect = "message" )
quiz( caption = "", 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) ) )
learnr
(install.packages("learnr")
) and gradethis
(remotes::install_github("rstudio-education/gradethis"
, which will also install learnr
) packages before a tutorial can be taken.devtools::install_github("WdeNooy/UsingRTutorials")
. First install devtools
package, which may require to update all other packages first.learnr::run_tutorial("introduction", "UsingRTutorials")
; opens in browser.UsingRTutorials
package is installed, the tutorials show up in the Tutorials tab (may take a few seconds), regardless of whether the tutorials package is loaded or not.learnr
learnr
tutorial is running, RStudio Help and Packages tabs can be used, packages can be installed in RStudio, commands can be run from the console, and it is possible to run a shiny app from RStudio. So a lot of functionality of the RStudio interface can be used. IMPORTANT:
learnr
versions higher than 0.10.1 (and gradethis
versions over 0.2.0.9000) will probably not accept the exercise solutions as set up now. The old learnr and gradethis vesions are saved in zip files, which can be unzipped into the folder containing the installed packages (check out: .libPaths()
) to restore these versions. I checked that this works on a mac.learnr
and gradethis
packages at the start of the course. Copy (NOT fork) the GitHub sites to my GitHub site and have students install the packages from there?gradethis
?invisible
for more information”. Tell students to ignore this message.Exercise setup (preparing data etc.):
With grade_code():
With grade_result():
Comparing ggplots:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.