Today we’re very pleased to announce the availability of RStudio Version 1.0! Version 1.0 is our 10th major release since the initial launch in February 2011 (see the full release history below), and our biggest ever! Highlights include:
Authoring tools for R Notebooks.
Integrated support for the sparklyr package (R interface to Spark).
Performance profiling via integration with the profvis package.
Many other miscellaneous enhancements and bug fixes.
R Notebooks add a powerful notebook authoring engine to R Markdown. Notebook interfaces for data analysis have compelling advantages including the close association of code and output and the ability to intersperse narrative with computation. Notebooks are also an excellent tool for teaching and a convenient way to share analyses.
As an authoring format, R Markdown bears many similarities to traditional notebooks like Jupyter and Beaker. However, code in notebooks is typically executed interactively, one cell at a time, whereas code in R Markdown documents is typically executed in batch.
R Notebooks bring the interactive model of execution to your R Markdown documents, giving you the capability to work quickly and iteratively in a notebook interface without leaving behind the plain-text tools, compatibility with version control, and production-quality output you’ve come to rely on from R Markdown.
In a typical R Markdown document, you must re-knit the document to see your changes, which can take some time if it contains non-trivial computations. R Notebooks, however, let you run code and see the results in the document immediately. They can include just about any kind of content R produces, including console output, plots, data frames, and interactive HTML widgets.
You can see the progress of the code as it runs:
You can preview the results of individual inline expressions, too:
Even your LaTeX equations render in real-time as you type:
This focused mode of interaction doesn’t require you to keep the console, viewer, or output panes open. Everything you need is at your fingertips in the editor, reducing distractions and helping you concentrate on your analysis. When you’re done, you’ll have a formatted, reproducible record of what you’ve accomplished, with plenty of context, perfect for your own records or sharing with others.
The sparklyr package is a new R interface for Apache Spark. RStudio now includes integrated support for Spark and the sparklyr package, including tools for:
Creating and managing Spark connections
Browsing the tables and columns of Spark DataFrames
Previewing the first 1,000 rows of Spark DataFrames
Once you’ve installed the sparklyr package, you should find a new Spark pane within the IDE. This pane includes a New Connection dialog which can be used to make connections to local or remote Spark instances:
Once you’ve connected to Spark you’ll be able to browse the tables contained within the Spark cluster:
The Spark DataFrame preview uses the standard RStudio data viewer:
“How can I make my code faster?”
If you write R code, then you’ve probably asked yourself this question. A profiler is an important tool for doing this: it records how the computer spends its time, and once you know that, you can focus on the slow parts to make them faster.
RStudio now includes integrated support for profiling R code and for visualizing profiling data. R itself has long had a built-in profiler, and now it’s easier than ever to use the profiler and interpret the results.
To profile code with RStudio, select it in the editor, and then click on Profile -> Profile Selected Line(s). R will run that code with the profiler turned on, and then open up an interactive visualization.
In the visualization, there are two main parts: on top, there is the code with information about the amount of time spent executing each line, and on the bottom there is a flame graph, which shows what R was doing over time. In the flame graph, the horizontal direction represents time, moving from left to right, and the vertical direction represents the call stack, which are the functions that are currently being called. (Each time a function calls another function, it goes on top of the stack, and when a function exits, it is removed from the stack.)
The Data tab contains a call tree, showing which function calls are most expensive:
Armed with this information, you’ll know what parts of your code to focus on to speed things up!
RStudio now integrates with the readr, readxl, and haven packages to provide comprehensive tools for importing data from many text file formats, Excel worksheets, as well as SAS, Stata, and SPSS data files. The tools are focused on interactively refining an import then providing the code required to reproduce the import on new datasets.
For example, here’s the workflow we would use to import the Excel worksheet at http://www.fns.usda.gov/sites/default/files/pd/slsummar.xls.
First provide the dataset URL and review the import in preview mode (notice that this file contains two tables and as a result requires the first few rows to be removed):
We can clean this up by skipping 6 rows from this file and unchecking the “First Row as Names” checkbox:
The file is looking better but some columns are being displayed as strings when they are clearly numerical data. We can fix this by selecting “numeric” from the column drop-down:
The final step is to click “Import” to run the code displayed under “Code Preview” and import the data into R. The code is executed within the console and imported dataset is displayed automatically:
Note that rather than executing the import we could have just copied and pasted the import code and included it within any R script.
We started working on RStudio in November of 2008 (8 years ago!) and had our first public release in February of 2011. Here are highlights of the various releases through the years:
|0.92||Feb 2011||* Initial public release|
|0.93||Apr 2011||* Interactive plotting with manipulate
* Source editor themes
* Configurable workspace layout
|0.94||Jun 2011||* Enhanced plot export
* Enhanced package installation and management
* Enhanced history management
|0.95||Jan 2012||* RStudio project system
* Code navigation (typeahead search, go to definition)
* Version control integration (Git and Subversion)
|0.96||May 2012||* Enhanced authoring for Sweave
* Web publishing with R Markdown
* Code folding and many other editing enhancements
|0.97||Oct 2012||* Package development tools
* Vim editing mode
* More intelligent R auto-indentation
|0.98||Dec 2013||* Interactive debugging tools
* Enhanced environment pane
* Viewer pane for web content / htmlwidgets
|0.98b||Jun 2014||* R Markdown v2 (publish to PDF, Word, and more)
* Integrated tools for Shiny application development
* Editor support for XML, SQL, Python, and Bash
|0.99||May 2015||* Data viewer with support for large datasets, filtering, searching, and sorting
* Major enhancements to R and C/C++ code completion and inline code diagnostics
* Multiple cursors, tab re-ordering, enhanced Vim mode
|0.99b||Feb 2016||* Emacs editing mode
* Multi-window source editing
* Customizable keyboard shortcuts
* RStudio Addins
|1.0||Nov 2016||* Authoring tools for R Notebooks
* Integrated support for sparklyr (R interface to Spark)
* Enhanced data import tools
* Performance profiling via integration with profvis
The RStudio Release History page on our support website provides a complete history of all major and minor point releases.
Welcome to the rstudio::glimpse() newsletter. Get a glimpse into our tools and how to use them.
Python users can now use Shiny to create interactive data-driven web applications by writing Python code.