Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

learnr and bookdown #168

Closed
davidmeza1 opened this issue Jun 22, 2018 · 25 comments
Closed

learnr and bookdown #168

davidmeza1 opened this issue Jun 22, 2018 · 25 comments
Labels
difficulty: advanced Best for maintainers to address effort: high 4+ days of work priority: low Will be fixed eventually type: enhancement Adds a new, backwards-compatible feature

Comments

@davidmeza1
Copy link

Is is possible to use bookdown to combine a group of tutorials and not lose learnr functionality.

@schloerke
Copy link
Collaborator

The hard part is that you need a shiny backend to run learnr, where as bookdown is multiple, static rmardown files.

I don't see this being implemented in the near future, but will keep the card open as hosting multiple learnr files seems fair.

@schloerke schloerke added difficulty: advanced Best for maintainers to address effort: high 4+ days of work priority: low Will be fixed eventually type: enhancement Adds a new, backwards-compatible feature labels Oct 5, 2018
@knachman
Copy link

I would be interested in this functionality as well. I'm creating a series of tutorials for my organization and it would be nice to combine them all into bookdown format.

@jienagu
Copy link

jienagu commented Nov 27, 2018

I would be interested in this functionality too. I am interested in documenting students' work into pdf or any other formats or have a widget for user to download their works. Bookdown might be a good option to fulfill this functionality.

@znmeb
Copy link

znmeb commented Nov 27, 2018

I'm looking into something like this - since there's a Shiny back end required, maybe flexdashboard would work as a learnr website creator.

@katiepress
Copy link

Flexdashboard would be fine too, the only thing I don't like about that is there isn't a way - or at least a reasonably simple way - that I've found to have the navbar on the side instead of the top? It just seems like a better workflow in a tutorial vs having to go up and pop the navbar open. That is one thing I like about the way the learnr tutorial output is set up, I just need more options for the heading levels on the table of contents, and preferably be able to collapse the toc as well.

It would be great to have a learnr output for shiny apps too where you could embed learnr chunks in your app just like a plot or whatever else. Or maybe there is a way to do that with htmlOutput or uiOutput already?

(I'm knachman as well I just changed my username recently)

@RaymondBalise
Copy link

Add me to the list of people who would use this. I would love to bundle all the tutorials for a class.

@LukasWallrich
Copy link

Yes, this would indeed be very helpful!

@vnijs
Copy link

vnijs commented Apr 13, 2020

+1 for this feature

@vnijs
Copy link

vnijs commented Apr 13, 2020

It is possible to have multiple rmarkdown documents with shiny run time in a website as in the example by @hugo-pa. This does not work with shiny_prerendered however due to rstudio/rmarkdown#1576. Since that doesn't work at the moment, is it possible to have learnr use runtime shiny rather than shiny_prerendered?

https://github.com/hugo-pa/shiny_website_example

@vnijs
Copy link

vnijs commented Apr 13, 2020

One more ... could you embed learnr apps in a shiny website? This works with shiny + knitr currently (link below). Could learnr somehow piggy-back on the shiny environment it is already running in?

GitHub: https://github.com/vnijs/shiny-site
Shinyapps.io: https://vnijs.shinyapps.io/shiny-site/

Related issues: #8, #86, #117, #205

@acircleda
Copy link

I am curious if there has been a working example of combining learnr and bookdown' yet. I too would like to combine them.

@coatless
Copy link
Contributor

The closest I've seen to replicating this functionality requires leaving the bookdown/learnr vs. and deploying with other tools. c.f.

  1. an RMarkdown document powered by a binder instance by @cderv
  2. a website outside of the rmarkdown framework.

@itsyaoyu
Copy link

itsyaoyu commented Jul 3, 2020

+1 I'm also looking to add interactive examples in a bookdown textbook. This would greatly increase student engagement with the material!

@dtkaplan
Copy link

dtkaplan commented Jul 4, 2020

=1 not to jump on the bandwagon, but I also would find this helpful. I am working on sets of tutorials to cover a whole semester course.

@hgreatrex
Copy link

I would also find this useful if possible

@zief0002
Copy link

zief0002 commented Feb 5, 2021

I echo the others in saying that this feature would be great to have.

@petzi53
Copy link

petzi53 commented Apr 14, 2021

I share the desire to put interactive exercises into a book and also thought primarily of a solution with bookdown.

But recently, I came across the very comprehensive tutorial of the OpenIntro project. Introduction to Modern Statistics is showcasing another approach: It uses the learnr package itself to provide extensive textual explanations. The huge eight tutorials consist of several large Rmd files with many chapters and sections so that they form an (interactive) textbook on their own.

But there is still also the textbook, written with bookdown to provide a general introduction to statistics independently from R.

@johannes-titz
Copy link

I would also love to see this functionality. For now, I use an rmarkdown website with a navigation bar at the top to access seven different tutorials: https://rlernen.de/ -- Not ideal, but works.

@kcarnold
Copy link

This came up today in a department conversation; we'd also be interested in seeing this work.

Since the main blocker is the shiny connection, https://quarto.org/docs/blog/posts/2022-10-25-shinylive-extension/ plus https://github.com/georgestagg/webR could be an approach: run everything in the browser.

Another direction could be to see if learnr code chunks could be embeddable, e.g., using iframes.

@gadenbuie
Copy link
Member

Distilling the advice in this conversation, for publishing a collection of tutorials I would recommend following the examples above:

  1. The OpenIntro project – Introduction to Modern Statistics – uses a website that organizes and links to many tutorials.
  2. Rlernen uses an R Markdown website and similarly links to many deployed tutorials.
  3. The Building Web Apps with Shiny course also uses an R Markdown website to showcase learnr tutorials that are paired with Posit Cloud projects (source repo). Importantly, this course uses a custom navbar to link between modules (tutorials) of the course.

The above represent the current best practices and in my opinion do an excellent job of balancing the requirements for deploying learnr tutorials with the organizational needs of material that span more than one learning session.

@gadenbuie gadenbuie closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2022
@irudnyts
Copy link

irudnyts commented Jun 20, 2023

If anyone still needs a workaround, I developed a small proof of concept: https://github.com/irudnyts/jsquiz. Basically, this is like {learnr}'s MCQs that use only JavaScript and do not require a Shiny backend. They work happily with {bookdown}.

I drafted this for internal purposes, but if anyone needs it, I'm happy to elaborate.

@coatless
Copy link
Contributor

I would also add {webexercises} that covers a bit more options w/o a Shiny backend and works across both RMarkdown & Quarto:

https://psyteachr.github.io/webexercises/

Source:

https://github.com/PsyTeachR/webexercises

You could also toy around with quarto-webr for crafting code exercises w/o Shiny:

https://github.com/coatless/quarto-webr

@irudnyts
Copy link

irudnyts commented Jun 20, 2023

@coatless very cool, thanks! I wish to see that in the morning -- would save me a day 🙂

@johannes-titz
Copy link

Regarding the new suggestions it would be helpful to state whether R code can actually be run. Seems to be only the case for quarto-webr, but this looks very promising! The rest seems to be just for creating quizzes, right?

@hgreatrex
Copy link

hgreatrex commented Jun 21, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: advanced Best for maintainers to address effort: high 4+ days of work priority: low Will be fixed eventually type: enhancement Adds a new, backwards-compatible feature
Projects
None yet
Development

No branches or pull requests