You are currently browsing Joe Cheng’s articles.
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!
Last month we released Shiny, our new R package for creating interactive web applications. The response from the community has been extremely encouraging–we’ve received a lot of great feedback that has helped us to make significant improvements to the framework already!
Shiny 0.2.3 on CRAN
Starting with Shiny 0.2.3, you can install the latest stable version of Shiny directly from CRAN. Since the initial release, we’ve added some interesting features to Shiny, most notably the ability to offer on-the-fly file downloads. We’ve also fixed some bugs, including an issue with runGist that caused it to fail on many Windows systems.
Install or upgrade now by running:
Coming soon: Shiny Server
While Shiny works great today for running apps on your own machine, we indicated in our original blog post that for web-based deployment we’d be offering hosting services and a software package for deploying Shiny applications on a server.
Today we have more details to share about Shiny Server, the software package which will allow you to deploy Shiny applications on your own server:
- Free and open source (AGPLv3 license)
- Host multiple applications on the same port, with a different URL path per application
- Allows Shiny applications to work with Internet Explorer 8 and 9
- Automatically starts and stops R sessions as needed
- Detects and recovers from crashed R sessions
- Designed to serve applications directly to browsers, or be proxied behind another web server like Apache/Nginx
- Works across network gateways and proxies that don’t support websockets
Our goal is to begin beta testing by the end of January. Shiny Server will require Linux at launch, though we will likely add Windows and Mac support later.
While we previously said that Shiny Server would be commercial software, we’ve decided to make it free and open source instead. Later in 2013 we hope to introduce a paid edition of Shiny Server that will include additional features that are targeted at larger organizations.
That’s all we have on the Shiny front for now. If you have questions, leave us a comment, or drop by our active and growing community at shiny-discuss!
Say hello to Shiny, a new R package that we’re releasing for public beta testing today.
Shiny makes it super simple for R users to turn analyses into interactive web applications that anyone can use. These applications let you specify input parameters using friendly controls like sliders, drop-downs, and text fields; and they can easily incorporate any number of outputs like plots, tables, and summaries.
More details, including live examples and a link to an extensive tutorial, can be found on the Shiny homepage.
The Shiny package is free and open source, and is designed primarily to run Shiny applications locally. To share Shiny applications with others, you can send them your application source as a GitHub gist, R package, or zip file (see details). We’re also working on a Shiny server that is designed to provide enterprise-grade application hosting, which we’ll offer as a subscription-based hosting service and/or commercial software package.
We’re really excited about Shiny, and look forward to seeing what kind of applications you come up with!