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 →

Creating beautiful demographic maps in R with the tidycensus and tmap packages

The tidycensus and tmap R packages make an incredible duo for working with and visualizing US Census data. The tidycensus package, authored by Kyle Walker, streamlines geographic and tabular data downloads while the tmap package, written by Martijn Tennekes, vastly simplifies creating maps with multiple layers, accepts many different spatial object types and makes it easy to add scale […]

Continue reading →

Tips and tricks for working with images and figures in R Markdown documents

Writing reports in R Markdown allows you to skip painful and error-prone copy-paste in favor of dynamically-generated reports written in R and markdown that are easily reproducible and updateable. R Markdown reports that are heavy on graphs and maps, though, can yield large HTML files that are not optimized for web viewing. R Markdown offers […]

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 →

Scrape website data with the new R package rvest (+ a postscript on interacting with web pages with RSelenium)

Copying tables or lists from a website is not only a painful and dull activity but it's error prone and not easily reproducible. Thankfully there are packages in Python and R to automate the process. In a previous post we described using Python's Beautiful Soup to extract information from web pages. In this post we […]

Continue reading →