## 11.3 What is the difference between a Notebook and a Markdown file?

A Notebook and an R Markdown file are essentially the same. They are documents in which markdown is combined with code to produce a fully-formatted final document.

An important difference is in the execution of code. In R Markdown, when the file is Run, all the elements (chunks) are also run. In a Notebook, when the file rendered with the Preview button, no code is re-run, only that which has already been run in and is present in the document is included in the output. Also, in the Notebook behind-the-scenes file (.nb) all the code is always included. Something to watch out for if your code contains sensitive information, such as a password (which it never should!). This is not the case in the R Markdown .tex file.