Learn how to…
Open and save project files using RStudio
Read vector data files (e.g. shapefile or GeoJSON) using the sf package
Filter data by attribute using the {dplyr} package
Create a map with the {ggplot2} package using an attribute to define the aesthetics of the map
Label and export a map using the {ggplot2} package
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Linking to GEOS 3.10.2, GDAL 3.4.2, PROJ 8.2.1; sf_use_s2() is TRUE
Optional bonus activities
Create one or more additional maps using any of the following approaches for an extra bonus points:
Create a multi-panel map using a faceting function. Typically, multi-panel maps are used for categorical variables or binned continuous variables. Consider using the dplyr::mutate()
function to re-code a categorical variable or using a binned scale to convert a continuous variable into a discrete variable.
Create a bar chart showing the distribution of the mapped attribute by location or a scatter plot to compare the mapped attribute data to another attribute in your data. Ch. 3 Data visualization in Wickham and Grolemund (2022) has examples of both types of data visualizations or you can explore the documentation for ggplot2::geom_bar()
or ggplot2::geom_point()
.
Add the PDF map and a RMarkdown file with a brief description of your process and the map to the assignment folder in your course GitHub repository. If your map uses data that is not included in the Natural Earth Quick Start file, you must include links to sources where the data can be downloaded to allow the project file to be opened for review and feedback. If data files are less than 50 MB, please add the files to the GitHub repository in the same folder as the project file.
References
Wickham, Hadley, and Garrett Grolemund. 2022.
R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. 2nd edition (WIP).
Sebastopol, CA:
O’Reilly Media.
https://r4ds.had.co.nz.