lab 7

Movietavern and Population Overlay - With Bonus

Author

Sofia Santana

library(tidyverse)
library(ggplot2)
library(ggthemes)
library(socviz)
library(maps)
library(mapproj)
library(questionr)
library(viridis)
library(leaflet)
library(tidycensus)

ACQUIRE THE DATA

The following code will read the dataset in directly from data.world.

https://data.world/data-hut/movietavern-location-dataset

movieUS <- read.csv("https://query.data.world/s/5xsdaezg32gho5hy4xklnwjsbuyuis?dws=00000", header=TRUE, stringsAsFactors=FALSE)

CREATE MAP FOR TEXAS LOCATIONS

Map Movietavern store locations JUST FOR in TX using leaflet package.

ACQUIRE ARKANSAS COUNTY-LEVEL POPULATION DATA FROM THE US CENSUS

Obtain your own census api key at: https://api.census.gov/data/key_signup.html
We will use the api key to directly download population data from the census.

OVERLAY MOVIETAVERN TO POPULATION

Let’s map the AR Population Census using the leaflet package.
This time we are using a different provider for the map: OpenStreetMap
Try swapping other maps – see a few below in the commented code.

ADD ON STARBUCKS LOCATIONS

Note – modified code slightly in the addPolygons() function to outline each county border in gray