forked from acowap/HW-4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
60 lines (37 loc) · 1.5 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "Homework 4"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
You are currently in the GitHub repository (repo) for `HW-4`. You must have
completed all the steps in [Setting
Up](https://rudeboybert.github.io/MATH216/jekyll/update/2016/09/12/getting-started.html).
## Learning Goals
* Working with choropleth maps in R
* Tackling a larger-scale more open-ended question
## Homework
1. Follow the same workflow as in <a target="_blank" class="page-link"
href="https://github.com/2016-09-Middlebury-Data-Science/HW-0#homework">HW-0</a>
for HW-4.
1. Do not submit a `HW-4.Rmd` file that does not knit.
1. I anticipate you spending between 8-12 total (across all submissions) on this
homework.
## Tips
* Use 2010 Census data; missing data should not be a problem except for [Fairfax
County, Virginia](http://www.census.gov/quickfacts/table/PST045215/51059) with
FIPS Code 51059.
* One-dimensional [center of mass](http://hyperphysics.phy-astr.gsu.edu/hbase/imgmec/cm.gif).
* To get the [centroids](https://en.wikipedia.org/wiki/Centroid) of all `n`
polygons in a `SpatialPolygons` class object in R use `sp::coordinates()`, which
returns a `n x 2` matrix where the first column is longitude and the second is
latitude. You can assume that the order of the centroids matches the order of
`counties_sp@data` in the example below:
```{r}
library(USAboundaries)
library(sp)
counties_sp <- us_counties()
centroids <- coordinates(counties_sp)
head(centroids)
```