You are currently browsing Joe Cheng’s articles.
Shiny Server 184.108.40.2065 and Shiny Server Pro 220.127.116.116 are now available! This release includes new features to support Shiny 0.14. It also updates our Node.js to 0.10.47, which includes important security fixes for SSL/TLS.
Connection robustness (a.k.a. grey-outs)
Shiny’s architecture is built on top of websockets, which are long-lived network connections between the browser and an R session on the server. If this connection is broken for any reason, the browser is no longer able to communicate with its R session on the server. Shiny indicates this to the user by turning the page background grey and fading out the page contents.
In Shiny 0.14 and Shiny Server 1.4.7, we’ve done work at both the server and package levels to minimize the amount of greyouts users will see. Simply by upgrading Shiny Server, transient (<15sec) network interruptions should no longer disrupt Shiny apps. And for many Shiny apps, a secondary, opt-in reconnection mechanism should all but eliminate grey-outs. This article on shiny.rstudio.com has all the details.
Shiny 0.14 introduced a “bookmarkable state” feature that made it possible to snapshot the state of a running Shiny app, and send it to someone as a URL to try in their own browser. At the app author’s option, the app state could either be fully encoded in the URL, or written to disk and referred to by a short ID. This latter approach requires support from the server, and that support is now officially provided by Shiny Server and Shiny Server 1.4.7. (This functionality is not yet available for ShinyApps.io, however.)
Coming soon: Shiny Server 1.5.0
Just a heads up: Shiny Server (Pro) 1.5.0 is coming in a few weeks. Shiny Server was originally written using Node.js 0.10, which is nearing the end of its lifespan. This release will move to Node.js 6.x.
Due to the complexity of this upgrade, Shiny Server 1.5.0 will not add any new features, except for supporting perfect forward secrecy for SSL/TLS connections. The focus will be entirely on ensuring a smooth and stable release.
We’ve just released Shiny Server and Shiny Server Pro 1.4.6. Relative to 1.4.2, our previously blogged-about version, the 1.4.6 release primarily includes bug fixes, and mitigations for low-severity security issues found by penetration testing. The full list of changes is after the jump.
If you’re running a Shiny Server Pro release that is older than 1.4.3 and are configured to use SSL/TLS, it’s especially important that you upgrade, as the versions of Node.js that are bundled with Shiny Server Pro 1.4.3 and earlier include vulnerable versions of OpenSSL.
Shiny Server (Open Source): Download now
This past January, we held the first ever Shiny Developer Conference. It was a chance to gather together a group of intermediate to advanced Shiny users, and take their skills to the next level.
It was an exciting event for me in particular, as I’ve been dying to share some of these intermediate and advanced Shiny concepts for years now. There are many concepts that aren’t strictly required to be productive with Shiny, but make a huge difference in helping you write efficient, robust, maintainable apps—and also make Shiny app authoring a lot more satisfying.
The feedback we received from conference attendees was overwhelmingly positive: everyone from relative novices to the most advanced users told us they gained new insights into how to improve their Shiny apps, or had a perspective shift on concepts they thought they already understood. The user-contributed lightning talks were also a big hit, helping people see what’s possible using Shiny and inspiring them to push their own apps further.
If you weren’t able to attend but are still interested in building your Shiny skills, we’re happy to announce the availability of videos of the tutorials and talks:
At the moment, these videos are our best sources of info on the topics of reactive programming, Shiny gadgets, Shiny modules, debugging Shiny apps, and performance. If you’re at all serious about writing Shiny apps, we highly recommend you take the time to watch!
If you’re interested in attending next year’s conference, you can sign up for our email list using the subscription form at the top of the Shiny Developer Conference 2016 Videos page, and we’ll let you know when more details are available.
Update Nov 2 2015: Wow, that was fast. Registration is full. If you add yourself to the waitlist, we’ll contact you first if/when we do this conference again.
In the three years since we launched Shiny, our focus has been on helping people get started with Shiny. But there’s a huge difference between using Shiny and using it well, and we want to start getting serious about helping people use Shiny most effectively. It’s the difference between having apps that merely work, and apps that are performant, robust, and maintainable.
That’s why RStudio is thrilled to announce the first ever Shiny Developer Conference, to be held at Stanford University on January 30-31, 2016, three months from today. We’ll skip past the basics, and dig into principles and practices that will simultaneously simplify and improve the robustness of your code. We’ll introduce you to some brand new tools we’ve created to help you build ever larger and more complex apps. And we’ll show you what to do if things go wrong.
Check out the agenda to see the complete lineup of speakers and talks.
We’re capping the conference at just 90 people, so if you’d like to level up your Shiny skills, register now at http://shiny2016.eventbrite.com.
Hope to see you there!
Note that this conference is intended for R users who are already comfortable writing Shiny apps. We won’t cover the basics of Shiny app creation at all. If you’re looking to get started with Shiny, please see our tutorial.
d3heatmap is designed to have a familiar feature set and API for anyone who has used heatmap or heatmap.2 to create static heatmaps. You can specify dendrogram, clustering, and scaling options in the same way.
d3heatmap includes the following features:
- Shows the row/column/value under the mouse cursor
- Click row/column labels to highlight
- Drag a rectangle over the image to zoom in
- Works from the R console, in RStudio, with R Markdown, and with Shiny
Here’s a very simple example (source: flowingdata):
library(d3heatmap) url <- "http://datasets.flowingdata.com/ppg2008.csv" nba_players <- read.csv(url, row.names = 1) d3heatmap(nba_players, scale = "column")
You can easily customize the colors using the
colors parameter. This can take an RColorBrewer palette name, a vector of colors, or a function that takes (potentially scaled) data points as input and returns colors.
Shiny 0.12 has been released to CRAN!
Compared to version 0.11.1, the major changes are:
- Interactive plots with base graphics and ggplot2
- Switch from RJSONIO to jsonlite
For a full list of changes and bugfixes in this version, see the NEWS file.
To install the new version of Shiny, run:
htmlwidgets is not required, but shiny 0.12 will not work with older versions of htmlwidgets, so it’s a good idea to install a fresh copy along with Shiny.
Interactive plots with base graphics and ggplot2
The major new feature in this version of Shiny is the ability to create interactive plots using R’s base graphics or ggplot2. Adding interactivity is easy: it just requires using one option in
plotOutput(), and then the information about mouse events will be available via the
You can use mouse events to read mouse coordinates, select or deselect points, and implement zooming. Here are some example applications:
- Basic interactions
- Advanced interactions: This demonstrates many advanced features of interactive plots.
- Excluding points (as depicted in the screen capture above)
Switch from RJSONIO to jsonlite
In previous versions of Shiny, the data was serialized to/from JSON using the RJSONIO package. However, as of 0.12.0, Shiny switched from RJSONIO to jsonlite. The reasons for this are that jsonlite has better-defined conversion behavior, and it has better performance because much of it is now implemented in C.
For the vast majority of users, this will have no impact on existing Shiny apps.
The htmlwidgets package has also switched to jsonlite, and any Shiny apps that use htmlwidgets also require an upgrade to that package.
A note about Data Tables
The version we just released to CRAN is actually 0.12.1; the previous version, 0.12.0, was released three weeks ago and deprecated Shiny’s
renderDataTable functions and instructed you to migrate to the nascent DT package instead. (We’ll talk more about DT in a future blog post.)
User feedback has indicated this transition was too sudden and abrupt, so we’ve undeprecated these functions in 0.12.1. We’ll continue to support these functions until DT has had more time to mature.
Shiny 0.10 is now available on CRAN.
In this release, the biggest changes were under the hood to support the creation of interactive documents. If you haven’t had a chance to check out interactive documents, we really encourage you to do so—it may be the easiest way to learn Shiny.
New layout functions
flowPanel()lays out its children in a left-to-right, top-to-bottom arrangement.
splitLayout()evenly divides its horizontal space among its children (or unevenly divides if cellWidths argument is provided).
flowPanel(), but with a light grey background, and is intended for encapsulating small input controls wherever vertical space is at a premium.
A new logical argument
inline was also added to
radioButtons() to arrange check boxes and radio buttons horizontally.
Custom validation error messages
Sometimes you don’t want your reactive expressions or output renderers in server.R to proceed unless certain input conditions are satisfied, e.g. a select input value has been chosen, or a sensible combination of inputs has been provided. In these cases, you might want to stop the render function quietly, or you might want to give the user a custom message. In shiny 0.10.0, we introduced the functions
need() which you can use to enforce validation conditions. This won’t be the last word on input validation in Shiny, but it should be a lot safer and more convenient than how most of us have been doing it.
See the article Write error messages for your UI with validate for details and examples.
Sever-side processing for Selectize input
For Shiny 0.10, we greatly improved the performance of our existing client-side Selectize binding, but also added a new mode that allows the paging, filtering, and sorting to all happen on the server. Only the results that are actually displayed are downloaded to the client. This approach works well for hundreds of thousands or millions of rows.
We also split off Shiny’s HTML generating library (
tags and friends) into a separate htmltools package. If you’re writing a package that needs to generate HTML programmatically, it’s far easier and safer to use htmltools than to paste HTML strings together yourself. We’ll have more to share about htmltools in the months to come.
actionLink()input control: behaves like
actionButton()but looks like a link
print()on its result if it’s visible–no more explicit
print()required for ggplot2
- Sliders and select boxes now use a fixed horizontal size instead of filling up all available horizontal space; pass
width="100%"if you need the old behavior
sessionobject that can be passed into a server function is now documented: see
- New reactive domains feature makes it easy to get callbacks when the current session ends, without having to pass
- Thanks to reactive domains, by default, observers now automatically stop executing when the Shiny session that created them ends
For the full list, you can take a look at the NEWS file. Please let us know if you have any comments or questions.
We’re excited to introduce to you our new website for Shiny: shiny.rstudio.com!
Whether you’re a beginner or expert at Shiny, we hope that having these resources available in one place will help you find the information you need.
We’d also like to announce Shiny 0.9, now available on CRAN. This release includes many bug fixes and new features, including:
New application layout options
Until now, the vast majority of Shiny apps have used a sidebar-style layout. Shiny 0.9 introduces new layout features to:
- Make it easy to create custom page layouts using the Bootstrap grid system. See our new application layout guide or a live example.
- Provide navigation bars and lists for separating your application into different pages. See navbarPage and navlistPanel, and this example.
- Enhance tabsetPanel to allow pill-style tabs, and to let tabs be placed above, below, or to either side of tab content.
- Create floating panels and place them relative to the sides of the page, optionally making them draggable. See absolutePanel or this example.
- Use Bootstrap themes to easily modify the fonts and colors of your application. Example
We have integrated selectize.js in shiny 0.9, and
selectInput now creates selectize inputs by default. (You can revert back to plain select inputs by passing
selectInput.) For more advanced uses, we have included a new
selectizeInput function that lets you pass options to selectize.
Shiny apps can now (optionally) run in a “showcase” mode in which the app’s R code can be automatically displayed within the app. Most of the Shiny example apps in our new gallery use showcase mode.
As you interact with the application, reactive expressions and outputs in server.R will light up as they execute. This can be helpful in visualizing the reactivity in your app.
See this article to learn more.
As always, you can install the latest release of Shiny by running this command at the R console:
The complete list of bug fixes and features is available in the NEWS file.
We hope you’ll find these new features helpful in exploring and understanding your data!
We’re very pleased to announce Shiny 0.8.0 (which actually went up on CRAN about two weeks ago). This release features a vastly better way to display tabular data, and new debugging tools that make it much easier to fix errors in your app.
We now support much more attractive and powerful displays of tabular data using the popular DataTables library. Our DataTables integration features pagination, searching/filtering, sorting, and more. Check out this demo to see it in action, and learn more about how to use it in your own apps by visiting the tutorial’s chapter on DataTables.
In version 0.8.0 of the Shiny package, we’ve greatly improved the set of debugging tools you can use with your Shiny apps. It’s now much easier to figure out what’s happening when things go wrong, thanks to two new features:
- Integration with the new visual debugger that’s available with RStudio v0.98. You can set breakpoints and step through your code much more easily than before.
- A new option ‘shiny.error’ which can take a function as an error handler. It is called when an error occurs in a reactive observer (e.g. when running an output rendering function). You can use options(shiny.error=traceback) to simply print a traceback, options(shiny.error=recover) for debugging from a regular R console, or options(shiny.error=browser) to jump into the RStudio visual debugger.
There have also been a few smaller tweaks and bug fixes. For the full list, you can take a look at our NEWS file.
Welcome, Yihui Xie!
If you’re reading this, there’s a good chance you have heard of Yihui Xie or have used his software; during his time as a PhD student at Iowa State University, he created the knitr, cranvas, and animation packages, among others.
We’re thrilled to announce that Yihui has joined the RStudio team! He will be one of the primary maintainers of the Shiny package and has already contributed some great improvements in the short time he has been with us.
Shiny makes it easy to develop interactive web applications that run on your own machine. But by itself, it isn’t designed to make your applications available to all comers over the internet (or intranet). You can’t run more than one Shiny application on the same port, and if your R process crashes or exits for any reason, your service becomes unavailable.
Our solution is Shiny Server, the application server for Shiny. Using Shiny Server, you can host multiple Shiny applications, as well as static web content, on a Linux server and make them available over the internet. You can specify what applications are available at what URL, or configure Shiny Server to let anyone with a user account on the server deploy their own Shiny applications. For more details, see our previous blog post.
Shiny Server is available as a public beta today. Follow the instructions on our GitHub project page to get started now!