Assignment 6: Vector Operations
Now that you’ve been introduced to predicates
, measures
, and transformers
in the sf
package. You should be able complete a relatively simple workflow for a spatial analysis. We’ll build on this again with raster data (using terra
) next week and then integrate both data models the week after that. By the end of this assignment you should be able to:
Use
predicates
and data manipulation tools from thedplyr
package to subset dataUse
transformers
to create new geometriesUse
measures
to calculate new values based on the transformed geometriesGenerate simple maps depicting the results of your calculation.
You’ll need to accept the link to access the questions.
Instructions
After you’ve joined the assignment repository, you should have this file (named Readme.md) inside of a R project named assignment-6-xx where xx is your github username (or initials).
Once you’ve verified that you’ve correctly cloned the assignment repository, create a new Quarto document. Name this file assignment-6-xxx.qmd and give it a title (like M Williamson Assignment 6). Make sure that you select the html output option (Quarto can do a lot of cool things, but the html format is the least-likely to cause you additional headaches). We’ll be using Quarto throughout the course so it’s worth checking out the other tutorials in the getting started section.
Copy the questions below into your document and change the color of their text.
Save the changes and make your first commit!
Answer the questions making sure save and commit at least 3 more times (having 4 commits is part of the assignment).
Render the document to html (you should now have at least 3 files in the repository: Readme.md, assignment-6-xx.qmd, and assignment-6-xx.html). Commit these changes and push them to the repository on GitHub. You should see the files there when you go to github.com.
The Assignment
We want to begin to assess the role of distance from schools in determining the education outcomes for Idahoans. We’ll use the landmarks_pnw.csv
and cejst_pnw.shp
datasets as the basis for this assignment. You’ll need to load the csv and convert it to an sf
object. We want to compare the percentage of individuals age 25 or over with less than a high school degree (HSEF
in the cejst dataset) for of counties within 50km of a school (MTFCC == K2543
) to those that are more than 50km. You’ll need to follow many of the same operations in the video example from class. Your assignment is:
- Write out the pseudocode for your analysis
- Translate the pseudocode into code chunks and create the necessary code (You’ll need to use things like
st_distance
,st_buffer
,st_sym_difference
) - Make a map for both the percentage of individuals with less than a high school degree in counties within 50km and beyond 50km (i.e. make 2 maps)
Solutions are here