The power of three: purrr-poseful iteration in R with map, pmap and imap

The purrr package is a functional programming superstar which provides useful tools for iterating through lists and vectors, generalizing code and removing programming redundancies. The purrr tools work in combination with functions, lists and vectors and results in code that is consistent and concise. In this post we focus primarily on the map family of […]

Continue reading →

Easy multi-panel plots in R using facet_wrap() and facet_grid() from ggplot2

One of the most powerful aspects of the R plotting package ggplot2 is the ease with which you can create multi-panel plots. With a single function you can split a single plot into many related plots using facet_wrap() or facet_grid(). Although creating multi-panel plots with ggplot2 is easy, understanding the difference between methods and some […]

Continue reading →

Convert Procreate illustrations into web-friendly svgs for interaction and animation

If you are interested in making beautiful custom data visualizations for the web, D3 and SVGs work great together. Both SVGs and D3 support interactivity and animation, offering a ton of flexibility to create unique interactive applications. Future posts will describe how to load and modify external SVGs with D3, but there are important steps […]

Continue reading →

Using the new R package, FedData, to access federal open datasets (including interactive graphics)

The FedData package (created by R. Kyle Bocinsky) is a great new R package that provides easy access to some important federal datasets. The package is well-designed and provides functions to download climate, elevation, hydrography and other data for your area of interest. The following five sources of data are currently available for download with […]

Continue reading →

Manipulating and mapping US Census data in R using the acs, tigris and leaflet packages

Census data the hard way Plotting census data with ggplot2 Interactive plotting with the leaflet package Options 1: Convert the data.frame back to a SpatialPolygonsDataFrame Options 2: Make use of the existing SpatialPolygonsDataFrame Census data the easy(er) way 1) Set up the packages 2) Get the spatial data (tigris) 3) Get the tabular data (acs) […]

Continue reading →