You are currently browsing Garrett.Grolemund’s articles.
RStudio has teamed up with Datacamp to create a new, interactive way to learn dplyr. Dplyr is an R package that provides a fast, intuitive way to transform data sets with R. It introduces five functions, optimized in C++, that can handle ~90% of data manipulation tasks. These functions are lightning fast, which lets you accomplish more things—with more data—than you could otherwise. They are also designed to be intuitive and easy to learn, which makes R more user friendly. But this is just the beginning. Dplyr also automates groupwise operations in R, provides a standard syntax for accessing and manipulating database data with R, and much more.
In the course, you will learn how to use dplyr to
filter()observations from your data in a targeted way
arrange()observations within your data set by value
- derive new variables from your data with
- create summary statistics with
- perform groupwise operations with
- use the dplyr syntax to access data stored in a database outside of R.
You will also practice using the
tbl data structure and the new pipe operator in R, %>%.
The course is taught by Garrett Grolemund, RStudio’s Master Instructor, and is organized around Datacamp’s interactive interface. You will receive expert instruction in short, clear videos as you work through a series of progressive exercises. As you work, the Datacamp interface will provide immediate feedback and hints, alerting you when you do something wrong and rewarding you when you do something right. The course is designed to take about 4 hours and requires only a basic familiarity with R.
Some of the most innovative Shiny apps share data across user sessions. Some apps share the results of one session to use in future sessions, others track user characteristics over time and make them available as part of the app.
This level of sophistication creates tricky design choices when you host your app on a server. A nimble server will open new instances of your app to speed up performance, or relaunch your app on a bigger server when it becomes popular. How should you ensure that your app can find and use its data trail along the way?
Shiny Server developer Jeff Allen explains the best ways to share data between sessions in Share data across sessions with ShinyApps.io, a new article at the Shiny Dev Center.
Registration is now open for the next Master R Development workshop led by Hadley Wickham, author of over 30 R packages and the Advanced R book. The workshop will be held on January 19 and 20th in the San Francisco bay area.
The workshop is a two day course on advanced R practices and package development. You’ll learn the three main paradigms of R programming: functional programming, object oriented programming and metaprogramming, as well as how to make R packages, the key to well-documented, well-tested and easily-distributed R code.
To learn more, or register visit rstudio-sfbay.eventbrite.com.
Want to see who is using your Shiny apps and what they are doing while they are there?
Google Analytics is a popular way to track traffic to your website. With Google Analytics, you can see what sort of person comes to your website, where they arrive from, and what they do while they are there.
Since Shiny apps are web pages, you can also use Google Analytics to keep an eye on who visits your app and how they use it.
RStudio is planning a new Master R Developer Workshop to be taught by Hadley Wickham in the San Francisco Bay Area on January 19-20. This will be the same workshop that Hadley is teaching in September in New York City to a sold out audience.
If you did not get a chance to register for the NYC workshop but wished to, consider attending the January Bay Area workshop. We will open registration once we have planned out all of the event details. If you would like to be notified when registration opens, leave a contact address here.
R Markdown is a framework for writing versatile, reproducible reports from R. With R Markdown, you write a simple plain text report and then render it to create polished output. You can:
- Transform your file into a pdf, html, or Microsoft Word document—even a slideshow—at the click of a button.
- Embed R code into your report. When you render the file, R will run the code and insert its results into your report. Use this feature to add graphs and tables to your report: if your data ever changes, you can update your figures by re-rendering the report.
- Make interactive documents and slideshows. Your report becomes interactive when you embed Shiny code.
You’ll learn how to
- Use R Markdown to create reproducible, dynamic reports. R Markdown offers one of the most efficient workflows for writing up your R results.
Create interactive documents and slideshows by embedding Shiny elements into an R Markdown report. The Shiny + R Markdown combo does more than just enhance your reports; R Markdown provides one of the quickest ways to make light weight Shiny apps.
Take advantage of RStudio’s built in features that support R Markdown
Learn more at shiny.rstudio.com/articles
RStudio will teach the new essentials for doing data science in R at this year’s Strata NYC conference, Oct 15 2014.
R Day at Strata is a full day of tutorials that will cover some of the most useful topics in R. You’ll learn how to manipulate and visualize data with R, as well as how to write reproducible, interactive reports that foster collaboration. Topics include:
9:00am – 10:30am
A Grammar of Data Manipulation with dplyr
Speaker: Hadley Wickham
11:00am – 12:30pm
A Reactive Grammar of Graphics with ggvis
Speaker: Winston Chang
1:30pm – 3:00pm
Analytic Web Applications with Shiny
Speaker: Garrett Grolemund
3:30pm – 5:00pm
Reproducible R Reports with Packrat and Rmarkdown
Speaker: JJ Allaire & Yihui Xie
The tutorials are integrated into a cohesive day of instruction. Many of the tools that we’ll cover did not exist six months ago, so you are almost certain to learn something new. You will get the most out of the day if you already know how to load data into R and have some basic experience visualizing and manipulating data.
Not available on October 15? Check out Hadley’s Advanced R Workshop in New York City on September 8 and 9, 2014.
Shiny v0.10 comes with a quick, handy guide. Use the Shiny cheat sheet as a quick reference for building Shiny apps. The cheat sheet will guide you from structuring your app, to writing a reactive foundation with server.R, to laying out and deploying your app.
(p.s. Visit the RStudio booth at useR! today for a free hard copy of the cheat sheet.)
R Markdown’s new interactive documents provide a quick, light-weight way to use Shiny. An interactive document embeds Shiny elements in an R Markdown report. The report becomes “live”, a choose your own adventure that readers can control and explore. Interactive documents are easy to create and easy to share.
Create an interactive document
To create an interactive document use RStudio to create a new R Markdown file, choose the Shiny document template, then click “Run Document” to show a preview:
Include Shiny widgets and outputs in your code chunks. R Markdown will insert the widgets directly into your final document. When a reader toggles a widget, the parts of the document that depend on it will update instantly.
That’s it! No extra files are needed.
Note that in order to use interactive documents you should be running the latest version of RStudio (v0.98.932 or higher). Alternatively if you are not using RStudio be sure to follow the directions here to install all of the required components.
Share your document
Interactive documents can be run locally on the desktop or be deployed Shiny Server v1.2 or ShinyApps just like any other Shiny application. See the RMarkdown v2 website for more details on deploying interactive documents.
Use pre-packaged tools
Interactive documents make it easy to insert powerful tools into a report. For example, you can insert a kmeans clustering tool into your document with one line of code, as below.
kmeans_cluster is a widget built from a Shiny app and intended for use in interactive documents.
You can build your own widgets with
shinyApp, a new function that repackages Shiny apps as functions.
shinyApp is easy to use. Its first argument takes the code that appears in an app’s ui.R file. The second argument takes the code that appears in the app’s server.R file. The source of
kmeans_cluster reveals how simple this is.
Be a hero
Ready to be a hero? You can use the `shinyApp` function to make out of the box widgets that students, teachers, and data scientists will use everyday. Widgets can
- fit models
- compare distributions
- visualize data
- demonstrate teaching examples
- act as quizzes or multiple choice questions
- and more
These widgets are not made yet, they are low hanging fruit for any Shiny developer. If you know how to program with Shiny (or want to learn), and would like to make your mark on R, consider authoring a package that makes widgets available for interactive documents.
To learn more about interactive documents visit http://rmarkdown.rstudio.com/authoring_shiny.html.