Impressions and notes from rstudio::conf2020

I’m just on my way back from this year’s rstudio::conf. Here’s an account of a few of the things which I found interesting, inspiring, or that might have some other impact in the future. I’m listing them by order of appearance in the conference.

The hexawall at rstudio::conf2020

The RMarkdown and Interactive Dashboards Workshop

I participated as a TA in the RMarkdown and Interactive Dashboard workshop led by Carl Howe and Yihui Xie. The workshop dealt with creating RMarkdown documents. Specifically adding interactivity using the flexdashboard package to turn a simple docuement into an interactive html with just a few yaml configurations.

Some attention was also given to combining different programming languages within documents, i.e. python via the reticulate package, but also css and many more.

A lesser known feature (at least for me) was the crosstalk package which makes it really easy for different widgets in an RMarkdown document talk to each other.

Yihui talked about some cool tips and tricks and features of rmarkdown (and surrounding packages). For example:

  • The use of the xaringan::infinite_moon_reader() to continously render an Rmd upon save (automatically knits the document)
  • Creating animation inside Rmds
  • LaTeX tricks within Rmds
  • Caching time consuming Rmd chunks
  • Many more

Actually, these are just a few, and there were 23 distinct tips. Yihui’s presentation is available here. All the materials of this workshop, and in fact all the workshops, is available in this github repo.

Here’s an example of an animation of a wave in an Rmd file. To replicate the example, use the following code in the chunk specifications: {r, animation.hook='gifski', fig.height=3, interval = 0.15}.

data_set <- crossing(frame = seq(0, 360, 30), x = seq(0, 2*pi, pi/10)) %>% 
  mutate(y = sin(x - frame*pi/360)) %>% 
  nest(data = c(x,y))

map(data_set$data, ~{
  ggplot(., aes(x, y)) + geom_line()
})

Cool, isn’t it?

If you’re into animations, there are other packages which can also accomplish this, such as the gganimate package.

Deploying End-to-End Data Science with Shiny, Plumber, and Pins

A nice talk by Alex Gold from RStudio. Showed a use case for a plumber api combined with a shiny app that talk to each other. For me, mainly the concept of pins as a quick approach for small to medium sized data sets was nice to see. You can easily put a data set in an S3 or any other means of storage on Azure, GCP, Github, etc. The downside compared to a database is that there is no frequent backup or an option to roll back changes.

We’re hitting R a million times a day so we made a talk about it

A talk by Heather and Jacqueline Nolis from T-Mobile. This was kind of a follow-up talk on what they discussed in the previous rstudio::conf (2019), but this time they came with some important lessons from their in-field experiences.

For example, talking about garbage collection in R which happens once in a while and causes response times to lag. Can be avoided by manually calling the garbage collection with gc().

Asynchronous programming in R

Winston Chang demonstrating some ways for Asynchronous programming with the later package.

An interesting thing he Winston demonstrated was that you can open up a server using websocket and httpuv to interact with the R process even if the rstudio console is busy (i.e., for example during a shiny app run).

Materials of the talk will probably be available here https://github.com/wch/2020-01-later, though as of the time of writing these lines, the repo is empty. Maybe later.

Of Teacups, Giraffes, & R Markdown

A lovely and ispiring talk by Desiree De Lean, about how she (and a co-author) used a sort of Gamification to develop a statistics course. The course is based on the mysterious world of teacup Giraffes, and introduces statistical concepts with a nice and appealing twist.

Another innovative approach this used was to combine learnr iframes within the RMarkdown book they used, which makes the experience of the learner interactive. The learnr segments are hosted in turn on shinyapps.io.

The book is available online here.

Styling Shiny apps with Saas and Bootstrap 4

Joe Chang introduced the bootstraplibpackage which provides much more flexibilty when composing your own theme for a shiny app. It takes away a lot of the pains related with CSS-ing your way aound the complexities of a shiny app UI.

The package is still experimental, more info here.

I talked to Joe Chang a bit, the package is not going to solve problems such as right-to-left localization for Hebrew.

3D ggplots with rayshader

A cool presentation by Tyler Morgan Wall author of the rayshader package. Demonstrated how ggplot2 charts can be easily rendered into a 3d model.

Mostly relevant for illustrating surfaces. The rayshader can be used to turn this plot:

surface <- crossing(x = seq(0, 2*pi, pi/20), y = seq(0, 2*pi, pi/20)) %>% 
  mutate(z = sin(x)*x + cos(3*y))
surface_plot <- ggplot(surface, aes(x = x, y = y, fill = z)) + 
  geom_tile()
surface_plot

Projected as a 3d model using the rayshader here:

rayshader::plot_gg(surface_plot)

Tyler also demonstrated how you can generate a movie with the camera browsing around the chart. Beware, rendering takes long.

Summary

Obviously, there were many more notable talks at the conference, but this post was meant as a short list highlighting just a few.

To sum up, the rstudio conf, was a great opportunity to meet up with collegues (old and new), brush up on some of the advanced and noval packages, see how the rstudio team is planning and seeing the future of RStudio and of the R ecosystem, and enjoy San Fransisco!

Partner and Head of Operations Research Department