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
- Create a new object representing all the objects that intersect, in some way, with Colorado and plot the result.
75
-
- Create another object representing all the objects that touch Colorado and plot the result.
71
+
The starting point of this exercise is to create an object representing Colorado state in the USA. Do this with the command
72
+
`colorado = us_states[us_states$NAME == "Colorado",]` (base R) or with with the `filter()` function (tidyverse) and plot the resulting object in the context of US states.
76
73
77
-
```{r 04-ex-4}
78
-
plot(us_states$geometry)
79
-
plot(Colorado$geometry, col = 2, add = TRUE)
74
+
- Create a new object representing all the states that geographically intersect with Colorado and plot the result (hint: the most concise way to do this is with the subsetting method `[`).
75
+
- Create another object representing all the objects that touch (have a shared boundary with) Colorado and plot the result (hint: remember you can use the argument `op = st_intersects` and other spatial relations during spatial subsetting operations in base R).
touches_colorado = us_states[colorado, , op = st_touches]
83
-
plot(us_states$geometry)
108
+
plot(us_states$geometry, main = "States that touch Colorado")
84
109
plot(touches_colorado$geometry, col = "grey", add = TRUE)
85
110
```
86
111
87
112
88
-
# What are the neighbouring states of Colorado?
89
-
90
113
E4. Use `dem = rast(system.file("raster/dem.tif", package = "spDataLarge"))`, and reclassify the elevation in three classes: low (<300), medium and high (>500).
91
114
Secondly, read the NDVI raster (`ndvi = rast(system.file("raster/ndvi.tif", package = "spDataLarge"))`) and compute the mean NDVI and the mean elevation for each altitudinal class.
0 commit comments