Malaria Incidence

Map visualization

Published

November 11, 2018

Notable topics: Map visualization

Recorded on: 2018-11-11

Timestamps by: Alex Cookson

View code

Screencast

Timestamps

malariaAtlas

Importing data using the malariaAtlas package

geom_line

Using geom_line function to visualize malaria prevalence over time

geom_point

Quick map visualization using longitude and latitude coordinates and the geom_point function

borders

Using borders function to add Kenyan country borders to map

scale_colour_gradient2

Using scale_colour_gradient2 function to change the colour scale of points on the map

arrange

Using arrange function to ensure that certain points on a map appear in front of/behind other points

%/%

Aggregating data into decades using the truncated division operator %/%

Starting to look at aggregated malaria data (instead of country-specific data)

sampleunique

Using sample and unique functions to randomly select a few countries, which are then graphed

last

Using last function to select the most recent observation from a set of arranged data

Creating a Bland-Altman plot to explore relationship between current incidence and change in incidence in past 15 years

anti_join

Using anti_join function to find which countries are not in the malaria dataset

maps

Using the iso3166 dataset set in the maps package to match three-letter country code (i.e., the ISO 3166 code) with country names

geom_polygontheme_voidcoord_map

Creating a world map using geom_polygon function (and eventually theme_void and coord_map functions)

Getting rid of Antarctica from world map

facet_wrap

Using facet_wrap function to create small multiples of world map for different time periods

Starting to create an animated map of malaria deaths (actual code writing starts at 57:45)

Starting with a single year after working through some bugs

regex_inner_join
fuzzyjoin

Using regex_inner_join function from the fuzzyjoin package to join map datasets because one of them has values in regular expressions

str_remove

As alternative to fuzzyjoin package in above step, using str_remove function to get rid of unwanted regex

gganimate

Starting to turn static map into an animation using gganimate package

The actual animated map

countrycode
countrycode

Using countrycode package to filter down to countries in a specific continent (Africa, in this case)

Summary of screencast