Getting started

We’re going to go over a few packages that will let you create interactive maps with R.

Now, these packages are all not native to R, they’re packages that interface with existing javascript libraries. They take your data and some stylistic options you’ve identified, and regenerates the code into javascript and html and css that those libraries recognize and thus display on a browser.

Note: You need to sign up for a Mapbox account and get an API key. Go ahead and do that now.

Why interactive maps?

Exploratory data analysis

  • For journalists, identify and possibly analyze geospatial patterns
  • Display many related points of data thanks to popups

For publishing

  • Gives readers control to look at what’s important specifically to them
  • Usually not a good mobile experience
    • Can interrupt scroll if not careful
    • Font size, circle size might not translate between desktop and mobile
    • For later: Learn how to implement media queries that respond to display size
    • Learn how to use pym.js
  • Can be resource hogs
    • Processing and memory power must be taken into consideration
    • Learn how to use rmapshaper
  • Need to learn CSS and Javascript to make tweaks
    • So many JS for journalists courses out there that I haven’t vetted yet
  • Too tempting to include everything when you should curate
    • Just because interactive maps lets you display more data points easily doesn’t mean you should
    • Learn how to curate from editors, experience and from others.

Interactive graphics in context

The plan for this class

We’ll focus the bulk of this class on Leaflet, because it’s been around the longest and because of that, people have created more plugins and ports for those plugins on R.

We’ll go over some new packages, like Mapdeck, too. But it just came out like last year so the plugins aren’t as robust as for Leaflet yet.

  • The upside is that it’s fast.
  • The downside is that there’s less room for customization.
  • You want to do more? Learn some Javascript and CSS.

Managing expectations

There’s not enough time in this class for you to learn all the ins and outs of every aspect of the functions we use to create these maps.

I want to expose you to as many new ideas and techniques as possible. So we’re going for shallow and wide instead of deep and focused.

This workshop is designed for you to come back as a reference point for your future projects. Come back to it as soon as possible when you leave New Orleans so you can absorb it while it’s still fresh in your mind.

I’m going to show you the raw data, what it takes to transform the data into a structure that works well with the visualization, and then we’ll generate the visualizations.

I’ve included links to the documentation so you hopefully you can fill in the gaps later on with the specifics. So bookmark this page.

I’ll also have these links on my site