6

RStudio renders mynotebook.nb.html file every time R Markdown document mynotebook.Rmd is saved. This process does not involve running code in chunks, so it is much faster than knitting a notebook into mynotebook.html. However, for large .Rmd documents, saving nb.html files can take a long time, and, unfortunately, it is required to wait for it to finish before one can start using the notebook again and run code in chunks.

Is there a way to configure RStudio to not to create nb.html files on save of an R Markdown document?

2 Answers 2

9

I've found out you can delete relevant output entry from the top section of your file. In my case it looks like:

---
title: "Document"
output:
html_notebook: default
---

Which causes creation of .nb.html on every save. If you remove the output tag, file is no longer created automatically. You can still knit to any output file from the Knit menu on the top (or press Ctrl+Shift+K for default. This will run all the chunks again, which may take a while.

You may want to consult this guide book for more information on how YAML tags work. I'm just beginning with them!

1
  • Thanks @Dedalus, spot on. I did have html_document setting in the top section, which I must have unthinkingly copied from somewhere and forgot about it. Deleting it stops the behaviour that I had described, and it is still possible to knit the HTML document with custom setting, because they are controlled in a different YAML tag, html_document. The guide book is a great resource!
    – Sergei
    Aug 30, 2018 at 20:11
0

Another reason (and solution) might be, that you clicked incidentally on the "Knit on Save" button located just under the Save-to-Disk-Symbol in RStudio. This was in my case the problem. Usually you should be able to save a rmd-file without triggering the knitting process. So - given this scenario - just uncheck the "Knit on Save" button.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.