You are currently browsing Joe Cheng’s articles.

We’re pleased to announce d3heatmap, our new package for generating interactive heat maps using d3.js and htmlwidgets. Tal Galili, author of dendextend, collaborated with us on this package.

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):

url <- ""
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.

Read the rest of this entry »

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:

install.packages(c("shiny", "htmlwidgets"))

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

Excluding points

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 input object.

You can use mouse events to read mouse coordinates, select or deselect points, and implement zooming. Here are some example applications:

For more information, see the Interactive Plots articles in the Shiny Dev Center, and the demo apps in the gallery.

Switch from RJSONIO to jsonlite

Shiny uses the JSON format to send data between the server (running R) and the client web browser (running JavaScript).

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 dataTableOutput and 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.

Interactive documents

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

Three new functions—flowLayout(), splitLayout(), and inputPanel()—were added for putting UI elements side by side.

  • 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).
  • inputPanel() is like 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 checkboxGroupInput() and 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 validate() and 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

In the previous release of Shiny, we added support for Selectize, a powerful select box widget. At that time, our implementation passed all of the data to the web page and used JavaScript to do any paging, filtering, and sorting. It worked great for small numbers of items but didn’t scale well beyond a few thousand items.

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.

For more details and examples, see the article Using selectize input on


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.

Other changes

  • New actionLink() input control: behaves like actionButton() but looks like a link
  • renderPlot() now calls 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
  • The session object that can be passed into a server function is now documented: see ?session
  • New reactive domains feature makes it easy to get callbacks when the current session ends, without having to pass session everywhere
  • Thanks to reactive domains, by default, observers now automatically stop executing when the Shiny session that created them ends
  • shinyUI and shinyServer

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:!


We’ve included articles on many Shiny-related topics, dozens of example applications, and an all-new tutorial for getting started.

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:

  1. Make it easy to create custom page layouts using the Bootstrap grid system. See our new application layout guide or a live example.
  2. Provide navigation bars and lists for separating your application into different pages. See navbarPage and navlistPanel, and this example.
  3. Enhance tabsetPanel to allow pill-style tabs, and to let tabs be placed above, below, or to either side of tab content.
  4. Create floating panels and place them relative to the sides of the page, optionally making them draggable. See absolutePanel or this example.
  5. Use Bootstrap themes to easily modify the fonts and colors of your application. Example

You can see many of these features in action together in our reimplementation of the Washington Post’s interactive article on Super Zips.

Selectize.js integration

The JavaScript library selectize.js provides a much more flexible interface compared to the basic select input. It allows you to type and search in the options, use placeholders, control the number of options/items to show/select, and so on.


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 selectize=FALSE to selectInput.) For more advanced uses, we have included a new selectizeInput function that lets you pass options to selectize.

Please check out this example to see a subset of features of the selectize input. There is also an example comparing the select and selectize input.

Showcase mode

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.

Showcase example

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.

DataTables support


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.

Debugging tools

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: install.packages('shiny')

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.

No HTML or JavaScript knowledge is necessary. If you have some experience with R, you’re just minutes away from combining the statistical power of R with the simplicity of a web page:

Shiny application screenshot

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!

(Special thanks to Bryan Lewis for authoring the websockets package, which is used heavily by Shiny.)

Shiny homepage


Get every new post delivered to your Inbox.

Join 19,075 other followers