DAT-4313 - GIS with R

Walmart and Population Overlay - With Bonus Starbucks

Dr. V

ACQUIRE THE DATA

The following code will read the dataset in directly from data.world.
You may need to join data.world, but I think it works without joining. (Joining is free.)

If you’d rather download and then import, here is the location of the dataset: https://data.world/data-hut/walmart-store-location-data

CREATE MAP FOR ARKANSAS LOCATIONS

Map Walmart store locations JUST FOR in AR 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 WALMART 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