<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/shiny-0-14/"></div></div><div><a data-url="https://www.r-bloggers.com/shiny-0-14/" data-counturl="https://www.r-bloggers.com/shiny-0-14/" data-count="horizontal" data-text="Shiny 0.14" 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/09/12/shiny-0-14/"> RStudio Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>A new Shiny release is upon us! There are many new exciting features, bug fixes, and library updates. We’ll just highlight the most important changes here, but you can browse through the <a target="_blank" href="https://shiny.rstudio.com/articles/upgrade-0.14.html#full-changelog">full changelog</a> for details. This will likely be the last release before shiny 1.0, so get out your party hats!</p>
<p>To install it, you can just run:</p>
<pre>install.packages(&quot;shiny&quot;)</pre>
<h2>Bookmarkable state</h2>
<p>Shiny now supports bookmarkable state: users can save the state of an application and get a URL which will restore the application with that state. There are two types of bookmarking: encoding the state in a URL, and saving the state to the server. With an encoded state, the entire state of the application is contained in the URL’s query string. You can see this in action with this app: <a target="_blank" href="https://gallery.shinyapps.io/113-bookmarking-url/">https://gallery.shinyapps.io/113-bookmarking-url/</a>. An example of a bookmark URL for this app is <a target="_blank" href="https://gallery.shinyapps.io/113-bookmarking-url/?_inputs_&n=200">https://gallery.shinyapps.io/113-bookmarking-url/?inputs&amp;n=200</a>. When the state is saved to the server, the URL might look something like: <a target="_blank" rel="nofollow" href="https://gallery.shinyapps.io/bookmark-saved/?state_id=d80625dc681e913a">https://gallery.shinyapps.io/bookmark-saved/?state_id=d80625dc681e913a</a> (note that this URL is not for an active app).</p>
<p><strong><em>Important note</em>:</strong> Saved-to-server bookmarking currently works with Shiny Server Open Source. Support on Shiny Server Pro, RStudio Connect, and <a target="_blank" href="http://shinyapps.io/">shinyapps.io</a> is under development and testing. However, URL-encoded bookmarking works on all hosting platforms.</p>
<p>See <a target="_blank" href="http://shiny.rstudio.com/articles/bookmarking-state.html">this article</a> to get started with bookmarkable state. There is also an <a target="_blank" href="http://shiny.rstudio.com/articles/advanced-bookmarking.html">advanced-level article</a>, and <a target="_blank" href="http://shiny.rstudio.com/articles/bookmarking-modules.html">a modules article</a> that details how to use bookmarking in conjunction with modules.</p>
<h2>Notifications</h2>
<p>Shiny can now display notifications on the client browser by using the <code>showNotification()</code> function. Use <a target="_blank" href="https://gallery.shinyapps.io/116-notifications/">this demo app</a> to play around with the notification API. For more, see our <a target="_blank" href="http://shiny.rstudio.com/articles/notifications.html">article</a> about notifications.</p>
<h2>Progress indicators</h2>
<p>If your Shiny app contains computations that take a long time to complete, a progress bar can improve the user experience by communicating how far along the computation is, and how much is left. Progress bars were added in Shiny 0.10.2. In Shiny 0.14, we’ve changed them to use the notifications system, which gives them a different look.</p>
<p><strong><em>Important note</em>:</strong> If you were already using progress bars and had customized them with your own CSS, you can add the <code>style = &quot;old&quot;</code> argument to your <code>withProgress()</code> call (or <code>Progress$new()</code>). This will result in the same appearance as before. You can also call <code>shinyOptions(progress.style = &quot;old&quot;)</code> in your app’s server function to make all progress indicators use the old styling.</p>
<p>To see new progress bars in action, see <a target="_blank" href="https://gallery.shinyapps.io/085-progress/">this app</a> in the gallery. You can also learn more about them in <a target="_blank" href="http://shiny.rstudio.com/articles/progress.html">here</a>.</p>
<h2>Modal windows</h2>
<p>Shiny has now built-in support for displaying modal dialogs like the one below (<a target="_blank" href="https://gallery.shinyapps.io/114-modal-dialog/">live app here</a>):</p>
<p align="center"><a target="_blank" href="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/modal-dialog.png?ssl=1"><img alt="Modal dialog" class="wp-image-3098" src="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/modal-dialog.png?resize=456%2C176&ssl=1" data-recalc-dims="1"></a></p>
<p>To learn more about modal dialogs in Shiny, read the <a target="_blank" href="http://shiny.rstudio.com/articles/modal-dialogs.html">article</a> about them.</p>
<h2><code>insertUI</code> and <code>removeUI</code></h2>
<p>Sometimes in a Shiny app, arbitrary HTML UI may need to be created on-the-fly in response to user input. The existing <code>uiOutput</code> and <code>renderUI</code> functions let you continue using reactive logic to call UI functions and make the results appear in a predetermined place in the UI. The <code>insertUI</code> and <code>removeUI</code> functions, which are used in the server code, allow you to use imperative logic to add and remove arbitrary chunks of HTML (all independent from one another), as many times as you want, whenever you want, wherever you want. This option may be more convenient when you want to, for example, add a new model to your app each time the user selects a different option (and leave previous models unchanged, rather than substitute the previous one for the latest one).</p>
<p>See <a target="_blank" href="https://gallery.shinyapps.io/111-insert-ui/">this simple demo app</a> of how one could use <code>insertUI</code> and <code>removeUI</code> to insert and remove text elements using a queue. Also see <a target="_blank" href="https://gallery.shinyapps.io/insertUI/">this other app</a> that demonstrates how to insert and remove a few common Shiny input objects. Finally, <a target="_blank" href="https://gallery.shinyapps.io/insertUI-modules/">this app</a> shows how to dynamically insert modules using <code>insertUI</code>.</p>
<p>For more, read <a target="_blank" href="http://shiny.rstudio.com/articles/dynamic-ui.html">our article</a> about dynamic UI generation and the reference documentation about <a target="_blank" href="http://shiny.rstudio.com/reference/shiny/latest/insertUI.html"><code>insertUI</code></a> and <a target="_blank" href="http://shiny.rstudio.com/reference/shiny/latest/removeUI.html"><code>removeUI</code></a>.</p>
<h2>Documentation for connecting to an external database</h2>
<p>Many Shiny users have asked about best practices for accessing external databases from their Shiny applications. Although database access has long been possible using various database connector packages in R, it can be challenging to use them robustly in the dynamic environment that Shiny provides. So far, it has been mostly up to application authors to find the appropriate database drivers and to discover how to manage the database connections within an application. In order to demystify this process, we wrote a series of articles (<a target="_blank" href="http://shiny.rstudio.com/articles/overview.html">first one here</a>) that covers the basics of connecting to an external database, as well as some security precautions to keep in mind (e.g. <a target="_blank" href="http://shiny.rstudio.com/articles/sql-injections.html">how to avoid SQL injection attacks</a>).</p>
<p>There are a few packages that you should look at if you’re using a relational database in a Shiny app: the <code>dplyr</code> and <code>DBI</code> packages (both featured in the article linked to above), and the brand new <code>pool</code> package, which provides a further layer of abstraction to make it easier and safer to use either <code>DBI</code> or <code>dplyr</code>. <code>pool</code> is not yet on CRAN. In particular, <code>pool</code> will take care of managing connections, preventing memory leaks, and ensuring the best performance. See this <a target="_blank" href="http://shiny.rstudio.com/articles/pool-basics.html"><code>pool</code> basics article</a> and the <a target="_blank" href="http://shiny.rstudio.com/articles/pool-advanced.html">more advanced-level article</a> if you’re feeling adventurous! (Both of these articles contain Shiny app examples that use <code>DBI</code> to connect to an external MySQL database.) If you are more comfortable with <code>dplyr</code> than <code>DBI</code>, don’t miss the article about the <a target="_blank" href="http://shiny.rstudio.com/articles/pool-dplyr.html">integration of <code>pool</code> and <code>dplyr</code></a>.</p>
<p>If you’re new to databases in the Shiny world, we recommend using <code>dplyr</code> and <code>pool</code> if possible. If you need greater control than <code>dplyr</code> offers (for example, if you need to modify data in the database or use transactions), then use <code>DBI</code> and <code>pool</code>. The <code>pool</code> package was introduced to make your life easier, but in no way constrains you, so we don’t envision any situation in which you’d be better off <em>not</em> using it. The only caveat is that <code>pool</code> is not yet on CRAN, so you may prefer to wait for that.</p>
<h2>Others</h2>
<p>There are many more minor features, small improvements, and bug fixes than we can cover here, so we’ll just mention a few of the more noteworthy ones. (For more, you can see the <a target="_blank" href="https://shiny.rstudio.com/articles/upgrade-0.14.html#full-changelog">full changelog</a>.).</p>
<ul>
<li><strong>Error Sanitization</strong>: you now have the option to sanitize error messages; in other words, the content of the original error message can be suppressed so that it doesn’t leak any sensitive information. To sanitize errors everywhere in your app, just add <code>options(shiny.sanitize.errors = TRUE)</code> somewhere in your app. Read <a target="_blank" href="http://shiny.rstudio.com/articles/sanitize-errors.html">this article</a> for more, or play with the <a target="_blank" href="https://gallery.shinyapps.io/110-error-sanitization/">demo app</a>.</li>
<li><strong>Code Diagnostics</strong>: if there is an error parsing <code>ui.R</code>, <code>server.R</code>, <code>app.R</code>, or <code>global.R</code>, Shiny will search the code for missing commas, extra commas, and unmatched braces, parens, and brackets, and will print out messages pointing out those problems. (<a target="_blank" href="https://github.com/rstudio/shiny/pull/1126">#1126</a>)</li>
<li><strong>Reactlog visualization</strong>: by default, the <a target="_blank" href="http://shiny.rstudio.com/reference/shiny/latest/showReactLog.html"><code>showReactLog()</code> function</a> (which brings up the reactive graph) also displays the time that each reactive and observer were active for:
<p align="center"><a target="_blank" href="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/reactlog.png?ssl=1"><img alt="reactlog" class="wp-image-3097" src="https://i2.wp.com/rstudioblog.files.wordpress.com/2016/09/reactlog.png?resize=456%2C269&ssl=1" data-recalc-dims="1"></a></p>
<p>Additionally, to organize the graph, you can now drag any of the nodes to a specific position and leave it there.
<li><strong>Nicer-looking tables</strong>: we’ve made tables generated with <code>renderTable()</code> look cleaner and more modern. While this won’t break any older code, the finished look of your table will be quite a bit different, as the following image shows:
<p align="center"><a target="_blank" href="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/render-table.png?ssl=1"><img alt="render-table" class="wp-image-3096" src="https://i0.wp.com/rstudioblog.files.wordpress.com/2016/09/render-table.png?resize=456%2C154&ssl=1" data-recalc-dims="1"></a></p>
<p>For more, read our <a target="_blank" href="http://shiny.rstudio.com/articles/render-table.html">short article</a> about this update, experiment with all the new features in this <a target="_blank" href="https://gallery.shinyapps.io/109-render-table/">demo app</a>, or check out the <a target="_blank" href="http://shiny.rstudio.com/reference/shiny/latest/renderTable.html">reference documentation</a>.

<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rstudioblog.wordpress.com/3086/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/rstudioblog.wordpress.com/3086/" 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/shiny-0-14/"></div></div><div><a data-url="https://www.r-bloggers.com/shiny-0-14/" data-counturl="https://www.r-bloggers.com/shiny-0-14/" data-count="vertical" data-text="Shiny 0.14" 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/09/12/shiny-0-14/"> 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/KRvCLbObxyc"></a></div></ul>