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
@@ -17,9 +17,9 @@ In this session, we will learn how to use origin-destination data. To do that we
17
17
18
18
- We will start with reviewing the homework from the previous session
19
19
- A short lecture on origin-destination data (see [slides](https://docs.google.com/presentation/d/1fKXK1ocCSkTQkTQn0eoYWURIfQuFgQwICFiDGVetMek/edit?usp=sharing))
20
-
- Practical session working with various data, including analysing origin-destination trip flows in London Cycle Hire System.
20
+
- Practical session working with various data, including analysing origin-destination in Bristol and origin-destination flows in London Cycle Hire System.
21
21
- Bonus: Geometry operations and spatial analysis
22
-
- Homework and next session
22
+
- Homework
23
23
24
24
# Review Homework
25
25
@@ -102,7 +102,6 @@ We will start with a simple map of the world. Load the `world` object from the `
102
102
::: {.panel-tabset}
103
103
## R
104
104
```{r}
105
-
#| eval: false
106
105
#| echo: true
107
106
#| output: false
108
107
world = spData::world
@@ -124,7 +123,6 @@ Use some basic R functions to explore the `world` object. e.g. `class(world)`, `
124
123
::: {.panel-tabset}
125
124
## R
126
125
```{r}
127
-
#| eval: false
128
126
#| warning: false
129
127
plot(world)
130
128
```
@@ -148,7 +146,7 @@ Note that this makes a map of each column in the data frame. Try some other plot
148
146
::: {.panel-tabset}
149
147
## R
150
148
```{r}
151
-
#| eval: false
149
+
152
150
plot(world[3:6])
153
151
plot(world["pop"])
154
152
```
@@ -173,7 +171,6 @@ Load the `nz` and `nz_height` datasets from the `spData` package.
173
171
::: {.panel-tabset}
174
172
## R
175
173
```{r}
176
-
#| eval: false
177
174
#| echo: true
178
175
#| output: false
179
176
nz = spData::nz
@@ -192,7 +189,6 @@ We can use `tidyverse` functions like `filter` and `select` on `sf` objects in t
192
189
::: {.panel-tabset}
193
190
## R
194
191
```{r}
195
-
#| eval: false
196
192
#| echo: true
197
193
#| output: false
198
194
canterbury = nz |> filter(Name == "Canterbury")
@@ -213,7 +209,7 @@ This syntax is not very clear. But is the equivalent to
213
209
## R
214
210
```{r}
215
211
#| echo: true
216
-
#| eval: false
212
+
217
213
canterbury_height = nz_height[canterbury, , op = st_intersects]
218
214
```
219
215
@@ -249,7 +245,6 @@ In this section we will look at basic transport data in the R package **stplanr*
249
245
Load the `stplanr` package as follows:
250
246
251
247
```{r}
252
-
#| eval: false
253
248
#| echo: true
254
249
#| output: false
255
250
library(stplanr)
@@ -264,7 +259,6 @@ First we will load some sample data:
264
259
::: {.panel-tabset}
265
260
## R
266
261
```{r}
267
-
#| eval: false
268
262
#| echo: true
269
263
od_data = stplanr::od_data_sample
270
264
zone = stplanr::cents_sf
@@ -284,7 +278,6 @@ Now we will rename one of the columns from `foot` to `walk`
284
278
::: {.panel-tabset}
285
279
## R
286
280
```{r}
287
-
#| eval: false
288
281
#| echo: true
289
282
od_data = od_data |>
290
283
rename(walk = foot)
@@ -303,7 +296,7 @@ Next we will made a new dataset `od_data_walk` by taking `od_data` and piping it
303
296
304
297
## R
305
298
```{r}
306
-
#| eval: false
299
+
307
300
#| echo: true
308
301
od_data_walk = od_data |>
309
302
filter(walk > 0) |>
@@ -325,7 +318,6 @@ We can use the generic `plot` function to view the relationships between variabl
325
318
::: {.panel-tabset}
326
319
## R
327
320
```{r}
328
-
#| eval: false
329
321
plot(od_data_walk)
330
322
```
331
323
@@ -341,7 +333,6 @@ R has built in modelling functions such as `lm` lets make a simple model to pred
341
333
::: {.panel-tabset}
342
334
## R
343
335
```{r}
344
-
#| eval: false
345
336
#| echo: true
346
337
model1 = lm(proportion_walk ~ proportion_drive, data = od_data_walk)
0 commit comments