From the course: Creating Maps with R

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Solution: Interactive choropleth of state coastline length

Solution: Interactive choropleth of state coastline length

From the course: Creating Maps with R

Solution: Interactive choropleth of state coastline length

(upbeat music) - Okay, let's solve this challenge by opening the script in 0510B and let's run the code line 20 through one. So that's going to load our packages, obtain shape files for the contiguous United States, and join those together with our state coastline data set line 19, we've left joint. Then line 23 through 24, I've started off our choropleth so that creates us a map showing us the contiguous United States. Let's improve this right away by changing the weight of the lines to one, and we'll change the color to white as well. Our next step is to create a pallet for our map so let's add a couple of new lines here and let's create a pallet called pal coastline kilometer and we're going to use the function color numeric for this and the first argument will specify our pallet. Vifidis, vifidis, and our domain is going to be US coastline dollar KM of coastline. So let's run line 23 and let's add this pallet to our map…

Contents