Useful R packages

2 minute read

There exists a vast world of R packages out there, and navigating each of them is beyond the scope of this limited post. What I have instead are 5 packages that I came across when looking for something very specific, and they helped me do that, and more.

scatterD3

I was looking to plot scatterplots with a hover over that would provide details of the point plotted. ScatterD3 lets you do that and more. For one you can add color, symbols and size to the plots. It also lets you zoom into the plot to enlarge those clustered points and understand what is going on there. Finally, there is a shiny app template that you can re-purpose for your needs, allowing you to reactively change variables, alter opacity, filter observations, and view some slick transitions as you do this! You can customize the tooltips displayed when you hover over a point to show additional variables than the ones plotted. This is absolutely fantastic!

doParallel

When running embarrassingly parallel computations such as simulations or loops that take a degree of patience (i.e. of the order of hours) to execute, it is a waste of the multi-core functionality of one’s laptop not to parallelize it. The doParallel package allows one to do exactly that. It is relatively straightforward to set up, though one has to make sure that all the functions and packages are passed to the foreach loop so that the worker nodes have them available. Once you have it set up and running, relax to the sound of your laptop fan buzz as you run on all cores.

dygraphs

This R package provides an R interface to the dygraphs javascript library. I like this package for its Google Finance chart-like range selector and ability to zoom in and out. Some might find the option to have a secondary y-axis useful, despite Hadley Wickham’s disdain for the secondary y-axis

printr

RMarkdown is great for documentation with its embedded R code, outputs, plots, and LaTex support, except tables are a pain! Given that one is always working with a table of some kind, this is a serious shortcoming. Enter printr. An excellent package that finally gives you the kind of clean tables that I had been looking for. I don’t have to cringe at the prospect of including tables in RMarkdown anymore thanks to printr.

shinydashboard

Shiny Dashboard allows you gather all your Shiny apps in one place. For those familiar with Shiny, the dashboard set-up is relatively straightforward. I like that one can add custom icons to the sidebar menu. Shiny Dashboard gives the playful Shiny apps a certain gravity.

Updated:

Leave a Comment