What are the differences between Rmarkdown and Rnotebook?

Asked

Viewed 82 times

4

The RMarkdown has become a very popular interface and file type in recent years. I believe this is due to the fact that it allows using a single software to write complete statistical analysis reports, with texts, tables, graphs, figures and references formatted. It also allows the compilation of these reports into html pages on the internet. After we learn to use it, we no longer need to switch between R/Stata/Sas/SPSS windows and Word, Excel, Latex, etc. There are even packages to help write books and doctoral theses with it. Obviously, there are also limitations and difficulties (at least for me) but that are beyond the scope of the question.

I recently noticed that when we choose the option to create a new Rnotebook document, a Rmarkdown document is also opened. The only difference that seems to exist is in YAML, where there is the parameter:

output: html_notebook

When this parameter is maintained, the button knit becomes a button preview, which allows the preview of the document as a page html. But after we finish the work and choose to compile the document (even as html), the YAML parameter is automatically changed to:

  html_document:
    df_print: paged

The button preview also disappears and in its place, returns the option knit. When we save the file, R saves with the same extension as Rmarkdown.

That is, there seems to be no more difference between the two types of document. Is that right? Is there any substantive and objective difference between Rmarkdown and Rnotebook? If so, could you give me examples?

1 answer

6


Rnotebook uses R Markdown, which is an extension of the Markdown markdown markup language with support for embedding blocks of R code. That is, in any case, it is the same file format, with the same syntax (you can even write the file in any text application, as well as any R or markdown code). The difference is in the execution of the code. Knit creates its own environment and all the code runs at once, R Notebook uses the global environment and runs one line at a time.

When you open/create a Markdown file using R Notebook, the markdown is converted to HTML to generate the preview, but no R code is executed at first. As it executes blocks of R code and/or saves the file, the preview is updated. To compile, the complete code is executed in a clean environment, so that only objects and values defined in the code blocks are part of the final document (so Preview adds and Knit appears).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.