You are currently browsing the monthly archive for June 2015.
To paraphrase Yogi Berra, “Predicting is hard, especially about the future”. In 1993, when Ross Ihaka and Robert Gentleman first started working on R, who would have predicted that it would be used by millions in a world that increasingly rewards data literacy? It’s impossible to know where R will go in the next 20 years, but at RStudio we’re working hard to make sure the future is bright.
Today, we’re excited to announce our participation in the R Consortium, a new 501(c)6 nonprofit organization. The R Consortium is a collaboration between the R Foundation, RStudio, Microsoft, TIBCO, Google, Oracle, HP and others. It’s chartered to fund and inspire ideas that will enable R to become an even better platform for science, research, and industry. The R Consortium complements the R Foundation by providing a convenient funding vehicle for the many commercial beneficiaries of R to give back to the community, and will provide the resources to embark on ambitious new projects to make R even better.
We believe the R Consortium is critically important to the future of R and despite our small size, we chose to join it at the highest contributor level (alongside Microsoft). Open source is a key component of our mission and giving back to the community is extremely important to us.
The community of R users and developers have a big stake in the language and its long-term success. We all want free and open source R to continue thriving and growing for the next 20 years and beyond. The fact that so many of the technology industry’s largest companies are willing to stand behind R as part of the consortium is remarkable and we think bodes incredibly well for the future of R.
We quietly introduced this package in December when we announced htmlwidgets, but in the months since then we’ve added a lot of new features and launched a new set of documentation. If you haven’t looked at leaflet lately, now is a great time to get reacquainted!
The Map Widget
The basic usage of this package is that you create a map widget using the
leaflet() function, and add layers to the map using the layer functions such as
addMarkers(), and so on. Adding layers can be done through the pipe operator
%>% from magrittr (you are not required to use
library(leaflet) m <- leaflet() %>% addTiles() %>% # Add default OpenStreetMap map tiles addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R") m # Print the map
There are a variety of layers that you can add to a map widget, including:
- Map tiles
- Markers / Circle Markers
- Polygons / Rectangles
- GeoJSON / TopoJSON
- Raster Images
- Color Legends
- Layer Groups and Layer Control
There are a sets of methods to manipulate the attributes of a map, such as
fitBounds(), etc. You can find the details from the help page
install.packages('DT') # run DT::datatable(iris) to see a "hello world" example
The main function in this package is
datatable(), which returns a table widget that can be rendered in R Markdown documents, Shiny apps, and the R console. It is easy to customize the style (cell borders, row striping, and row highlighting, etc), theme (default or Bootstrap), row/column names, table caption, and so on.
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.
It’s time to share “What’s New” in shinyapps.io!
- Custom Domains – host your shiny applications on your own domain (Professional Plan only). Learn more.
- Bigger applications – include up to 1GB of data with your application bundles!
- Bigger packages – until now shinyapps.io could only support installation of packages under 100MB; now it’s 1GB! (attention users of BioConductor packages especially)
- Better locale detection – the newest shinyapps package now detects and maps your locale appropriately if it varies from the locale of shinyapps.io (you will need to update your shinyapps package)
- Application deletion – you can now delete applications permanently. First archive your application, then delete it. Note: Be careful; all deletes are permanent.
- Transfer / Rename accounts – select a different name for your account or transfer control to another shinyapps.io account holder.
- “What’s New” is New – your dashboard displays the latest enhancements to shinyapps.io under…you guessed it… “What’s New”!
We’ve added two new tools that make it even easier to learn Shiny.
The How to Start with Shiny training video provides a new way to teach yourself Shiny. The video covers everything you need to know to build your own Shiny apps. You’ll learn:
- The architecture of a Shiny app
- A template for making apps quickly
- The basics of building Shiny apps
- How to add sliders, drop down menus, buttons, and more to your apps
- How to share Shiny apps
- How to control reactions in your apps to
- update displays
- trigger code
- reduce computation
- delay reactions
- How to add design elements to your apps
- How to customize the layout of an app
- How to style your apps with CSS
Altogether, the video contains two hours and 25 minutes of material organized around a navigable table of contents.
Best of all, the video tutorial is completely free. The video is the result of our recent How to Start Shiny webinar series. Thank you to everyone who attended and made the series a success!
Watch the new video tutorial here.
New cheat sheet
The new Shiny cheat sheet provides an up-to-date reference to the most important Shiny functions.
The cheat sheet replaces the previous cheat sheet, adding new sections on single-file apps, reactivity, CSS and more. The new sheet also gave us a chance to apply some of the things we’ve learned about making cheat sheets since the original Shiny cheat sheet came out.
Get the new Shiny cheat sheet here.
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.
“Master” R in Washington DC this September!
Join RStudio Chief Data Scientist Hadley Wickham at the AMA – Executive Conference Center in Arlington, VA on September 14 and 15, 2015 for this rare opportunity to learn from one of the R community’s most popular and innovative authors and package developers.
It will be at least another year before Hadley returns to teach his class on the East Coast, so don’t miss this opportunity to learn from him in person. The venue is conveniently located next to Ronald Reagan Washington National Airport and a short distance from the Metro. Attendance is limited. Past events have sold out.