What is the use case for notebooks versus general RMarkdown HTML

I feel like I am missing something and don't understand what the real benefits to Rmd Notebooks are (e.g. nb.html) compared to regular html documents produced from RMarkdown. Can anyone explain this to me?
Thank you.

2 Likes

All I can say is that I've never found a use for nb over Rmd.

Hello!

I thought I just read another post about this. So what I learned is this:

Rmarkdown needs to be re-knitted everytime you want to see the changes to the document.

Rnotebook caches the document and you can see changes in real time for the chunk that your are working on.

So the advantage comes if your document takes a long time to knit. Otherwise, I believe they are the same.

1 Like

There are some output advantages if you want to share your code with others to review but not the actual raw files, you can hide and show code chunks for readability. Some chunks can become huge, and might just be data cleaning. No reason others shouldn't see it but may be better folded.

The "concept" is that it is a lab book. So you don't change the results. But you can provide additional information around the results.

I've found that notebooks are well-suited to teaching students and having them turn in homework problems that are move often a collection of short exercises than an entire analysis of research data.

1 Like

I use them in teaching all the time. I host my class lectures on Github and publish them as html through GitHub.io. Slides are done in xaringan and along with that I make a large 'narrative' document covering the topics discussed (the slides are a summary of this document) and homework are both provided as RNotebooks. From GitHub.io the students can download the RMD file for both narrative & homework directly with the built-in download button at the top right. Works like a charm and most of the time it is autoupdating when the students work through it. I've found this setup very helpful in teaching basic Data Literacy as well as GIS in R.

2 Likes

@ThurstonCounty Would you be willing to send me a link to one of your courses? this is the set up I need.

Sure. My repository is here (don't tell my students, the answer keys are there as well). I've set it up to build all the lecture slides, narratives, and homework into an index page in html that is then served up from the 'docs' folder. If you look here, you can see all the individual lecture topics. I'm working from the base building blocks of single topics so that I can put them together in different ways when teaching different classes.

1 Like

Another difference has to do with the output format. For example, I am now working with output with large and wide tables. The nb.html format handles those tables elegantly, creating HTML output that allows the reader to move sideways and to move across different pages. The plain HTML is, in comparison, kind of ugly and unfriendly, breaking the lines. For me, documenting my work and communicating with colleagues, the nb.html format is much nicer. Also ... as others have indicated ... the output is refreshed every time you make a change and save ... no need to deal with out-of-date versions that need to be re-knit.

There are some HTML outputs like fancy tables from reactable and skimr and interactive plots from plotly that require knitting to documents. Knitting to documents also gives access to higher quality image output.

This can be fixed with the df_print option in the header.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.