Is There a to create an HTML from R-Markdown like R-Notebook Produces

So I normally use R-Notebook and I didn't know about Markdown. I'm not going to change over to Markdown. But I just learned that knitting to an HTML from Markdown doesn't let you create an HTML like R-Notebook's.

R-Notebook automatically creates an HTML and in the upper right hand corner there's a drop down that allows the you to either "Show All Code" or "Hide All Code" as well as "rmd Download". When I was originally taught in R, my professor said R Notebooks are meant for sharing your code. So we never used anything else but R Notebook--and I still haven't changed that habit.

The downloadable part is the important part because my group and I just found out that while my HTMLs from Notebook are downloadable as R files, the knitted HTML files from Markdown does not have the downloadable option like mine do. This is not a huge problem because we can send both the HTML and R files back and forth.

But it would be good to know if there is a way to create an HTML from Markdown that is rmd downloadable, the way R Notebook allows them to download my files.

Everything about notebooks is covered in this link

From a sharing standpoint, the problem with X.nb.html is that it's static, rather than interactive in the same way as X.Rmd, where you can run chunks, edit them and run again, etc. And, of course, not everyone is interested in recoding a chunk, but would like to know what happens if you change an assumption or run the code on a different view of the data. That's what shiny is for.

Assuming your group is at all the same level, they can, of course, knit the Rmd file to create an HTML file, with, or without editing. Or, a knitted file could be posted to a website, using blogdown. For multiple authors, github is a great choice.

As far as learning markdown, there's always the option of coding in HTML, the awkwardness of which markdown was invented to relieve. If that's a dealbreaker, there's the Swiss Army Knife (complete edition) of document converters, pandoc, which interconverts among most formats which are known to UC Berkeley.

Thanks for the link and the explanation. I've never used Markdown so I don't know how to create an editable knit file. I don't think they did when I spoke with them about the difference between our HTMLs.

I'm also not certain what this means:

From a sharing standpoint, the problem with X.nb.html is that it's static, rather than interactive in the same way as X.Rmd, where you can run chunks, edit them and run again, etc.

I know that when they download my R Notebook HTML it becomes the same R Notebook I was looking at. But I know that when we're using R Script it doesn't have the chunks the R Notebook has, which is why I use the R Notebook.

You don't have the reply to this if it's too much trouble. Appreciate the help and explanation. Maybe they'll know about Shiny better than me.

Thanks again! I'll go over the Shiny part of the Link you sent.

I'll try to give you some answer but also asked some question to get more precisions.

I'll assume you are currently uses rmarkdown::html_notebook. Know that this format is very close to rmarkdown::html_document but with other default as argument (and also specific feature)

That means when using rmarkdown::html_document format, you can activate those feature you describe from html_notebook
See the documentation

  • code_folding will be use to add the show / hide button
  • code_download if TRUE will activate the rmd download button

Those options are activated by default in the html_notebook format
See the help page too:
code_folding can be change, code_download is fixed.

is the code_download argument in html_document format this downloable feature you are looking for ?

Hope it helps


Thanks! I'm pretty certain this is definitely what I need. I'll just have to figure out how to make it work via the codes in your links.

Not much experience in Markdown or this kind of thing so it'll probably take a good few tries.


Sorry to be unclear. Here is what a rmarkdown file called nb.Rmd looks like, and this is how the resulting html file appears

If you download one to a project directory, it's possible to "play with"; for the other, the only thing possible is to look at it.

With the Rmd file, it's possible to change the chunks, run them individually in the edit window or, with highlighting and CTLR ENTER in the console window. If you exchange those, everyone can play along. Passing around the html file is like passing around photos.

1 Like

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