US Wind Turbines

Animated map (gganimate package)

Published

November 5, 2018

Notable topics: Animated map (gganimate package)

Recorded on: 2018-11-05

Timestamps by: Alex Cookson

View code

Screencast

Timestamps

count

Using count function to explore categorical variables

geom_point

Creating a quick-and-dirty map using geom_point function and latitude and longitude data

coord_map
mapproj

Explaining need for mapproj package when plotting maps in ggplot2

borders

Using borders function to add US state borders to map

fct_lump

Using fct_lump to get the top 6 project categories and put the rest in a lumped "Other" category

Changing data so that certain categories' points appear in front of other categories' points on the map

Taking the centroid (average longitude and latitude) of points across a geographic area as a way to aggregate categories to one point

ifelse

Using ifelse function to clean missing data that is coded as "-9999"

Asking, "How has turbine capacity changed over time?"

Exploring different models of wind turbines

mutate_if

Using mutate_if function to find NA values (coded as -9999) in multiple columns and replace them with an actual NA

gganimate

Reviewing documentation for gganimate package

gganimate

Attempting to set up gganimate map

gganimate

Understanding gganimate package using a "Hello World" / toy example, then trying to debug turbine animation

is.infinite

Using is.infinite function to get rid of troublesome Inf values

crossing

Quick hack for getting cumulative data from a table using crossing function (though it does end up with some duplication)

gganimate

Diagnosis of gganimate issue (points between integer years are being interpolated)

gganimate

Pseudo-successful gganimate map (cumulative points show up, but some points are missing)

Summary of screencast