From the course: Creating Maps with R
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Work with sf datasets and the tidyverse
From the course: Creating Maps with R
Work with sf datasets and the tidyverse
- Let's demonstrate how we can use sf objects with the tidiverse. I'll start by loading my packages on lines one through three and I'm going to read in some shape files on line five using the read sf function. And if I take this object and print it to the console we can see it's a simple feature collection. We've several columns and we've got a region column division and the state name column are three columns. I want to highlight. And we're also going to import a CSV file that contains populations for each state. So for one line seven, and I print this object to a console you can see that we've got the column state and population. Now I want to join these two data sets together. And so I'm going to create a new object to contain this joined data set called 'US state pop'. And whenever we are joining sf objects we must start with an sf object first. So we'll take US states, I'll pipe it into the function, left join, and we're…