learnr is an open source package for R that extends R markdown documents into interactive tutorials. learnr implements code chunks termed exercises that allow users to execute R code and see its results. Use this tag for questions regarding exercise setup, creation of interactive tutorial questions, and grading of exercise answers.
Questions tagged [learnr]
42 questions
2
votes
1 answer
How to use the checkr package with learnr?
The exercise tutorial to the learnr package refers to the checkr packages:
The checkr package currently provides code checking functions that are compatible with learnr.
(Be aware that this reference does not point to the CRAN package checkr.…

petzi
- 1,430
- 1
- 17
- 32
1
vote
1 answer
how to make the radian console stop listening to rendered output?
I use the radian console in VSCode.
To replicate my problem, run:
learnr::run_tutorial("Hello", package = "learnr")
The tutorial (which is basically a shiny app) pops up in a viewer and the output of the console is this:
Loading required package:…

uke
- 462
- 1
- 11
1
vote
1 answer
Can I remove the "copy to clipboard" button in a learnr tutorial?
In the learnr tutorial, the exercise block allows you to view the solution and then click "copy to clipboard". For some reason, when the user selects "copy to clipboard" and then pastes it in the exercise block, an error is introduced. I want to…

FG120
- 61
- 1
- 4
1
vote
2 answers
Reset a learnr window when it first appears
I am creating an intro to R tutorial with learnr:tutorial. One thing I have is an empty R window so people can play around with it as a basic calculator. When I go back to the shinyapps page it often has the previous code in the window that I was…

Benn Fine
- 11
- 3
1
vote
0 answers
How to setup a secure code evaluator in LearnR like rstudio.cloud does?
When we use the self-hosted version of Learn R or hosted version in shinyapps.io, the user can print out variables that contain the tutorial source code using the code evaluator.
For example in shinyapps hosted version, the user can run…

Elvin Chu
- 150
- 1
- 8
1
vote
0 answers
Allow several ways to respond with learnr
I am developing a tutorial using learnr (using gradethis to check codes).
Here is my set-up chunk.
```{r setup, include=FALSE}
library(learnr)
library(gapminder)
gm <- data.frame(gapminder)
library(tidyverse)
…

djourd1
- 459
- 4
- 14
1
vote
0 answers
In learnr can you have exercise chunks with incorrect code?
I'm writing a learnr course, I want to provide students with faulty code for them to fix, or demonstrate an error. For example:
---
title: "coding - intro"
output:
learnr::tutorial:
progressive: true
allow_skip: true
runtime:…

pluke
- 3,832
- 5
- 45
- 68
1
vote
1 answer
Randomly take wrong answers of a quiz question from dataframe column, instead of doing by hand
I try to make a kind of learning tool using learnr package. We have one question and for answers where one is the correct one:
Instead of putting in eachtime a wrong answer by hand I would like to take the WRONG answers randomly from the…

TarJae
- 72,363
- 6
- 19
- 66
1
vote
1 answer
How do I change the theme of a learnr tutorial?
I am trying to change the theme of the learnr tutorial document from the default "rstudio" to something else. I've looked at the cran documentation and it seems to imply that I can use any of the following visual themes ("rstudio", default",…

Sara_Luttenbacher
- 36
- 2
1
vote
1 answer
`learnr` and `gradethis` code boxes do not run after the second opening
I coauthor a teaching package depending on learnr that offers tutorials for students enrolled in our course. We are encountering problems when running the tutorials.
Install mypackage depending on learnr and gradethis
restart R
open any tutorial: it…

CZuC
- 69
- 6
1
vote
1 answer
LearnR Rmd knit to pdf failed to compile after update of MikTex
After I updated MikTex to the latest version, my Rmd files don't compile anymore. I installed tinytex, reinstalled miktex, R and RStudio several times. I use some newcommands like \C, \G etc. in a tex document which I include in my Rmd file. I use…

Sa So
- 11
- 1
1
vote
2 answers
Install "gradethis" package for code checking in "learnr"
I am creating the interactive tutorials for R for presentation using "learnr" package. For code checking, I need the package "gradethis". When I try to install this package by
"
remotes::install_github("rstudio-education/gradethis")
"
it gives the…

david wei
- 31
- 4
1
vote
0 answers
Quiz questions in shiny
I am trying to embed quiz questions from learnr package in shiny app. Since v0.10.0 leanr quiz questions are mini shiny applications, i thought it would be easy to add it in shiny. Unfortunately it doesn't work (dont load…

Ujjawal Bhandari
- 1,333
- 1
- 8
- 16
0
votes
0 answers
How to block progression in a learnr tutorial until the answer to the current chunk is correct?
I have set a progressive reveal in my tutorial as detailed here. This prevents the user from skipping an exercise. The user has to provide an answer but not necessarily a correct one. I would like to use the package gradethis to check the answer and…
0
votes
0 answers
How do I count the correct answers in an interactive quiz in learnr?
This is a simple shiny_prerendered Rmd file. I want to count the number of correct answers from user interactions. Additionally, I would like to know how to reset the quiz programmatically, which would allow me to start over with all the questions…

Enrique Pérez Herrero
- 3,699
- 2
- 32
- 33