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
0
votes
1 answer
How to make `learnr` tutorials appear in a certain order?
When authoring an R package with learnr tutorials, is there a way to make them appear in an order that is not alphabetical, but user defined?
See the following example: The hello tutorial is most basic and should appear first. But the tutorials are…

uke
- 462
- 1
- 11
0
votes
0 answers
R object class is coerced to function in py object using {reticulate} to create a {learnr} tutorial
I'm not able to get the correct type of an R object which I need to use in a Python object while creating a learnr tutorial in R. I attached an image where I tried to present to you a sample example and the error I got. For your information, when I…

Mouna Belaid
- 653
- 1
- 6
- 11
0
votes
1 answer
in learnr, how to make external links open in new tab
I am using the r package learnr and would like all links (to external material) to open in a new tab. I could probably just add
but I don't know how to add header tags in learnr. I believe this isn't possible in ordinary…

Steve Powell
- 1,646
- 16
- 26
0
votes
1 answer
Use external datafile in `learnr` exercise
I am trying to write a learnr tutorial in which one of the exercises is to import an SPSS dataset. From the learnr documentation:
There are three ways authors can include files for use in exercises:
Store the files in a data/ directory in the same…

Claudio
- 1,229
- 6
- 11
0
votes
1 answer
Why `code_folding: hide` doesnt give the option to hide/show code in Rmarkdown?
This is my Rmarkdown code:
---
title: "Tutorial"
output:learnr::tutorial:
code_folding: hide
runtime: shiny_prerendered
---
```{r setup}
library(learnr)
knitr::opts_chunk$set(echo = FALSE)
```
## Topic 1
### Exercise
*Here's a simple…

Laura
- 675
- 10
- 32
0
votes
1 answer
LearnR generates "Reactive context was created in one process and accessed from another' when calling DT::datatable()
The following learnR tutorial generates an error when it is "run", and the code box's run button is pressed. The notebook works fine if I omit the DT:datable function but I need to use this in my true implementation in order to get access to the…
0
votes
1 answer
Sharing variables between chunks in learnr tutorial app with "chained setup chunks"
I am building a learnr tutorial app to teach some statistical techniques. Ideally I would like to share variables between code chunks, but I believe I can create a work-around using "setup chunks".
I've tried using "Chained setup chunks" as per this…

dobb798
- 1
0
votes
1 answer
How to render multiple `quiz` objects in one chunk using a loop in markdown?
I would like to render multiple objects of the function quiz of the library learnr using a loop in one chunk. The R is compiling the html-markdownfile without problems, but the rendering is not correct. It is rendering text and not a question as it…

Mario GS
- 859
- 8
- 22
0
votes
1 answer
How can I wrap an interactive R learnr tutorial in a package?
I’m new to creating learnr tutorials and even more to creating packages, but after reading tutorials on these two topics, I can now create simple packages and simple learnr tutorials. Now that I know a bit about both topics, I would like to deploy…

mokdur
- 3
- 3
0
votes
1 answer
Rmarkdown import latest webcam image?
I'm writing a learnr::tutorial markdown for my students, and would like one of the slides to show the latest image from the webcam on Palmer Station, Antarctica:
https://www.usap.gov/videoclipsandmaps/palwebcam.cfm
However, the field doesn't…

Silviculturalist
- 199
- 11
0
votes
1 answer
How to show/hide text in learnr tutorial / rmarkdown document?
Question: is there an easy way to toggle show/hide text in learnr tutorials? I know that you can use code folding in rmarkdown to show/hide code but what I'd like to do is have a "show answer" which then shows a paragraph explaining something. Quite…

user3359624
- 304
- 2
- 13
0
votes
1 answer
It is possible to store in memory code from one exercise to another in learnr?
I have created a tutorial in learnr and I have noticed that for each code chunk that I create, I need to rerun the code from previous chunks if I wish to use the same data.
For instance, if I have something like this :
oneway <- aov(data=iris,…

Codrin Mironiuc
- 121
- 1
- 6