You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
E1. It was established in Section \@ref(spatial-vec) that Canterbury was the region of New Zealand containing most of the 100 highest points in the country.
9
9
How many of these high points does the Canterbury region contain?
10
10
11
+
**Bonus:** plot the result using the `plot()` function to show all of New Zealand, `canterbury` region highlighted in yellow, high points in Canterbury represented with black dots and
12
+
13
+
11
14
```{r 04-ex-e1}
12
15
library(tmap)
13
16
# tmap_mode("view")
14
17
qtm(nz) + qtm(nz_height)
15
18
canterbury = nz %>% filter(Name == "Canterbury")
16
19
canterbury_height = nz_height[canterbury, ]
20
+
nz_not_canterbury_height = nz_height[canterbury, , op = st_disjoint]
17
21
nrow(canterbury_height) # answer: 70
22
+
23
+
plot(nz$geom)
24
+
plot(canterbury$geom, col = "yellow", add = TRUE)
25
+
plot(nz_not_canterbury_height$geometry, pch = 4, col = "blue", add = TRUE)
26
+
plot(canterbury_height$geometry, pch = 3, col = "red", add = TRUE)
18
27
```
19
28
20
-
E2. Which region has the second highest number of `nz_height` points in, and how many does it have?
29
+
E2. Which region has the second highest number of `nz_height` points, and how many does it have?
0 commit comments