<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/r-notebooks/"></div></div><div><a data-url="https://www.r-bloggers.com/r-notebooks/" data-counturl="https://www.r-bloggers.com/r-notebooks/" data-count="horizontal" data-text="R Notebooks" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://blog.rstudio.org/2016/10/05/r-notebooks/"> RStudio Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Today we’re excited to announce <a target="_blank" href="http://rmarkdown.rstudio.com/r_notebooks.html">R Notebooks</a>, which add a powerful notebook authoring engine to <a target="_blank" href="http://rmarkdown.rstudio.com/">R Markdown</a>. Notebook interfaces for data analysis have compelling advantages including the close association of code and output and the ability to intersperse narrative with computation. Notebooks are also an excellent tool for teaching and a convenient way to share analyses.</p>
<p><img alt="screen-shot-2016-09-21-at-3-42-44-pm" class="wp-image-3190" src="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/screen-shot-2016-09-21-at-3-42-44-pm.png?resize=456%2C479&ssl=1" data-recalc-dims="1"></p>
<p>You can try out R Notebooks today in the <a target="_blank" href="https://www.rstudio.com/products/rstudio/download/preview/">RStudio Preview Release</a>.</p>
<h2>Interactive R Markdown</h2>
<p>As an authoring format, R Markdown bears many similarities to traditional notebooks like <a target="_blank" href="https://jupyter.org/">Jupyter</a> and <a target="_blank" href="http://beakernotebook.com/">Beaker</a>. However, code in notebooks is typically executed interactively, one cell at a time, whereas code in R Markdown documents is typically executed in batch.</p>
<p>R Notebooks bring the interactive model of execution to your R Markdown documents, giving you the capability to work quickly and iteratively in a notebook interface without leaving behind the plain-text tools and production-quality output you’ve come to rely on from R Markdown.</p>
<table>
<tbody>
<tr>
<th></th>
<th>R Markdown Notebooks</th>
<th>Traditional Notebooks</th>
</tr>
<tr>
<td>Plain text representation</td>
<td>✓</td>
<td></td>
</tr>
<tr>
<td>Same editor/tools used for R scripts</td>
<td>✓</td>
<td></td>
</tr>
<tr>
<td>Works well with version control</td>
<td>✓</td>
<td></td>
</tr>
<tr>
<td>Focus on production output</td>
<td>✓</td>
<td></td>
</tr>
<tr>
<td>Output inline with code</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr>
<td>Output cached across sessions</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr>
<td>Share code and output in a single file</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr>
<td>Emphasized execution model</td>
<td>Interactive &amp; Batch</td>
<td>Interactive</td>
</tr>
</tbody>
</table>
<p>This video provides a bit more background and a demonstration of notebooks in action:</p>
<p><iframe height="315" width="450" allowfullscreen="true" src="https://www.youtube.com/embed/zNzZ1PfUDNk?version=3&rel=1&%23038;fs=1&%23038;autohide=2&%23038;showsearch=0&%23038;showinfo=1&%23038;iv_load_policy=1&%23038;wmode=transparent" type="text/html"></iframe></p>
<div>
<h2>Iterate Quickly</h2>
<p>In a typical R Markdown document, you must re-knit the document to see your changes, which can take some time if it contains non-trivial computations. R Notebooks, however, let you run code and see the results in the document immediately. They can include just about any kind of content R produces, including console output, plots, data frames, and interactive <a target="_blank" href="http://www.htmlwidgets.org/">HTML widgets</a>.</p>
<p><img alt="screen-shot-2016-09-20-at-4-16-47-pm" class="wp-image-3144" src="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/screen-shot-2016-09-20-at-4-16-47-pm.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>You can see the progress of the code as it runs:</p>
<p><img alt="screen-shot-2016-09-21-at-10-52-02-am" class="wp-image-3184" src="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/screen-shot-2016-09-21-at-10-52-02-am.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>You can preview the results of individual inline expressions, too:</p>
<p><img alt="notebook-inline-output" class="wp-image-3149" src="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/notebook-inline-output.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Even your LaTeX equations render in real-time as you type:</p>
<p><img alt="notebook-mathjax" class="wp-image-3111" src="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/notebook-mathjax.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>This focused mode of interaction doesn’t require you to keep the console, viewer, or output panes open. Everything you need is at your fingertips in the editor, reducing distractions and helping you concentrate on your analysis. When you’re done, you’ll have a formatted, reproducible record of what you’ve accomplished, with plenty of context, perfect for your own records or sharing with others.</p>
</div>
<div>
<h2>Batteries Included</h2>
<p>R Notebooks can run more than just R code. You can run chunks <a target="_blank" href="http://rmarkdown.rstudio.com/authoring_knitr_engines.html">written in other languages</a>, like Python, Bash, or C++ (Rcpp).</p>
<p><img alt="screen-shot-2016-09-20-at-4-25-48-pm" class="wp-image-3147" src="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/screen-shot-2016-09-20-at-4-25-48-pm.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>It’s even possible to run SQL directly:</p>
<p><img alt="notebook-sql" class="wp-image-3114" src="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/notebook-sql.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>This makes an R Notebook an excellent tool for orchestrating a reproducible, end-to-end data analysis workflow; you can easily ingest data using your tool of choice, and share data among languages by using packages like <a target="_blank" href="https://cran.r-project.org/web/packages/feather/index.html">feather</a>, or ordinary CSV files.</p>
<h2>Reproducible Notebooks</h2>
<p>While you can run chunks (and even individual lines of R code!) in any order you like, a fully reproducible document must be able to be re-executed start-to-finish in a clean environment. There’s a built-in command to do this, too, so it’s easy to test your notebooks for reproducibility.</p>
<p><img alt="screen-shot-2016-09-21-at-3-52-34-pm" class="wp-image-3192" src="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/screen-shot-2016-09-21-at-3-52-34-pm.png?w=456&ssl=1" data-recalc-dims="1"></p>
<h2>Rich Output Formats</h2>
<p>Since they’re built on R Markdown, R Notebooks work seamlessly with other R Markdown output types. You can use any existing R Markdown document as a notebook, or render (knit) a notebook to any R Markdown output type.</p>
<p><img alt="notebook-yaml" class="wp-image-3117" src="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/notebook-yaml.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>The same document can be used as a notebook when you’re quickly iterating on ideas and later rendered to a wholly different format for publication – no duplication of code, data, or output required.</p>
</div>
<div>
<h2>Share and Publish</h2>
<p>R Notebooks are easy to share with collaborators. Because they’re plain-text files, they work well with version control systems like Git. Your collaborators don’t even need RStudio to edit them, since notebooks can be <a target="_blank" href="http://rmarkdown.rstudio.com/r_notebook_format.html">rendered in the R console</a> using the open source <a target="_blank" href="https://cran.r-project.org/web/packages/rmarkdown/index.html">rmarkdown</a> package.</p>
<p>Rendered notebooks can be previewed right inside RStudio:</p>
<p><img alt="notebook-preview" class="wp-image-3150" src="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/notebook-preview.png?resize=456%2C377&ssl=1" data-recalc-dims="1"></p>
<p>While the notebook preview looks similar to a rendered R Markdown document, the notebook preview does not execute any of your R code chunks; it simply shows you a rendered copy of the markdown in your document along with the most recent chunk output. Because it’s very fast to generate this preview (again, no R code is executed), it’s generated every time you save the R Markdown document.</p>
<p>The generated HTML file has the special extension <em>.nb.html</em>. It is self-contained, free of dependencies, and can be viewed locally or published to any static web hosting service.</p>
<p><img alt="screen-shot-2016-09-14-at-12-12-35-pm" class="wp-image-3127" src="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/screen-shot-2016-09-14-at-12-12-35-pm.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>It also includes a bundled copy of the R Markdown source file, so it can be seamlessly opened in RStudio to resume work on the notebook with all output intact.</p>
<h2>Try It Out</h2>
<p>To try out R Notebooks, you’ll need to download the latest <a target="_blank" href="https://www.rstudio.com/products/rstudio/download/preview/">RStudio Preview Release</a>.</p>
<p>You can find documentation on notebook features on the <a target="_blank" href="http://rmarkdown.rstudio.com/r_notebooks.html">R Notebooks</a> page on the R Markdown website, and we’ve also published a video tutorial in our <a target="_blank" href="https://www.rstudio.com/resources/webinars/introducing-notebooks-with-r-markdown/">R Notebooks Webinar</a>.</p>
<p>We believe the R Notebook will become a powerful new addition to your toolkit. Give it a spin and let us know what you think!</p>
</div>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rstudioblog.wordpress.com/3103/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/rstudioblog.wordpress.com/3103/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/r-notebooks/"></div></div><div><a data-url="https://www.r-bloggers.com/r-notebooks/" data-counturl="https://www.r-bloggers.com/r-notebooks/" data-count="vertical" data-text="R Notebooks" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://blog.rstudio.org/2016/10/05/r-notebooks/"> RStudio Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/AdBradFMbtk"></a></div>