Skip to content
R for the Rest of Us Logo

Mapping with R

34 lessons

Make a Choropleth Map of Continuous Variables with leaflet (03_07)

This lesson is locked

Get access to all lessons in this course.

If the video is not playing correctly, you can watch it in a new window


Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

Open project 03_07. Use the your-turn.R script in 03_07 to build this map.

  • Add the provided popup function

  • Customise the NA label and color

Learn More

As mentioned in the video there’s a known issue with NA legend items being placed in a really awkward position. The solution I’ve provided is the only custom CSS I’ve provided in this course.

I’ve also provided you with a function for adding popups to both choropleth that depend on the function pmap(). This is because when the popups are generated the function receives both entire column at once, instead of receiving individual pairs of arguments. To learn more about the mapping functions I highly recommend the Iteration chapter of the R for Data Science book.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Kristina Bratkova

Kristina Bratkova

May 27, 2022

Hello, many thanks for the course; great content! I had a question about CRS. london_school_leavers_sf creates error when mapped and needs to be transformed to 4326. However, south_atlantic_prisons does not create an error (NAD83 general US CRS is used). Is BNG special CRS that leaflet struggles with? Also, at this large scale, is there a visual difference between using a national CRS compared to 4326?