learnR compiled document and interactive bash shell

I suspect that this is a little out of the normal flow for how most may use learnr, but in my course, I am also teaching some basics on the command line. In RMarkdown, there are all sorts of engines, including bash, but it would be great if I could, at the very least, have an interactive shell in the document that is running.

I am not expecting to run exercises via this approach (check code to provide feedback), but simply provide a quick interface into an interactive terminal within the document so that the students can type commands and get shell-level feedback.

The alternative is that I jump out of the knit & stylized document with context surrounding the terminal, and jump into the shell that way.

Obviously its not the end of the world that we can't, as learnR is well, geared towards R, but I wanted to see if I was missing a setting or if this is way outside the scope of what might be possible.

I am only starting to dip my toe into learnR, but I am blown away by what is possible, especially when you consider code evaluation and grading.

@Brock, I think I must be completely misunderstanding your setup. Assuming it's RStudio, there's a terminal tab, as shown in the attached screenshot.


Thanks, I am aware that there is a terminal tab in RStudio. The difference is that with an RMarkdown document, it becomes a highly stylized and interactive HTML document. learnr provides a feature to enable an interactive R shell within that document, which is amazing. This topic is to confirm that the only way to use a bash terminal is indeed via the RStudio IDE and not a compiled RMarkdown document.

My use case: A built RMarkdown document is great for teaching. The inclusion of an interactive shell to reinforce the content around the shell is even better. It's not the end of the world to leave the RMarkdown document to go to the terminal in RStudio, but now I am switching contexts.

The comparison is juypter/Google Collab notebooks where the stylized content is front and center with the interactive component integrated into the content.

We don't really have this in R today. We can build beautiful documents, websites, slide decks, etc, but the interactive shell around the stylized content is lacking. R Notebooks would be perfect if the content rendered as we went, but it doesn't; we have to knit the document which in my use case, defeats the purpose.

I had great success teaching using Google Collab notebooks last semester, and RMarkdown with learnr is the closest that has comes to that in my opinion. It's great for R of course, but I was hoping to change the engine, as we can today in RMarkdown.

1 Like

Well, I was pretty sure that I didn't understand the question. I couldn't find any mention in the RMarkdown book (although there are some other interactivity features, and I suppose you could embed system calls in a chunk, but that would be a kludge).

Why not post a feature request to the github repository?


This is out of the scope for native learnr implementation. Unfortunately, there is no development plans yet to allow for multiple execution engines in a learnr document.

Please thumbs up this issue if it suits your needs: https://github.com/rstudio/learnr/issues/213

1 Like

I just did, thanks for the note.

1 Like

Also... please test the rc-v0.10.0 branch of learnr and report any bugs on https://github.com/rstudio/learnr/issues you find. I'm going to release to CRAN once they lift their vacation block in a couple weeks.


Thank you in advance!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.