Skip to content

Commit 81c2085

Browse files
Merge pull request #289 from itsleeds/update-s4
Update Session 4 to align with new syllabus order
2 parents ee41c54 + 18c761a commit 81c2085

File tree

1 file changed

+10
-79
lines changed

1 file changed

+10
-79
lines changed

s4/index.qmd

Lines changed: 10 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ In this session, we will learn how to use origin-destination data. To do that we
2323

2424
# Review Homework
2525

26-
Your homework last week was to review some AI written code. Divide into groups of 2-3 people and share the question you asked AI, the code it produced, and the results it got.
26+
In the previous session and for your homework, you used AI to assist with loading datasets, creating visualizations, and working through vignettes on origin-destination (OD) using the `od` and `pct` packages. Let's evaluate your findings in groups of 2-3.
2727

28-
* Does the code run first time?
29-
* Do the results answer the question?
30-
* Try modifying the code and the prompt to improve the code generated by the AI.
31-
* Discuss in your groups the strengths and weaknesses of AI written code.
28+
* **The Workflow**: Show your group the specific prompts you gave the AI, the code it generated, and the resulting output.
29+
30+
* **The "First Run"** Test: Did the code run the first time? If it failed, what caused the error (e.g., outdated library syntax, incorrect file paths, or spatial projection issues)?
31+
32+
* **Accuracy**: Did the AI truly understand the spatial logic of data, or did it just provide a generic visualization?
33+
34+
* **Refinement**: Share how you modified your prompts or the code itself to achieve a better, more accurate result.
3235

3336
# Getting started with GIS in R
3437

@@ -1073,79 +1076,7 @@ bike_trips |>
10731076
# Homework
10741077

10751078
1. Read Chapters 2-5 of [Geocomputation with R](https://r.geocompx.org/transport.html)
1076-
2. Using knowledge about datasets and new skills covered in the practicals 2 and 3, think of a simple research question that could be answered by analysing/visualising/modelling one of the datasets imported into R in your previous homework (or another dataset you have imported into R).
1077-
3. Write a prompt, starting with your own code that imports the code, to generate some code answering the question and write it down in a new Quarto file called `gen-ai-test.qmd`.
1078-
4. Copy the prompt and paste it into a generative AI chat interface such as [ChatGPT](https://chatgpt.com), [Claude](https://claude.ai/), [DeepSeek](https://chat.deepseek.com/) or [Gemini](https://gemini.google.com/)
1079-
5. Paste the resulting code into a code chunk in a new .qmd file, e.g. called `gen-ai-test.qmd`.
1080-
- Does the code run first time?
1081-
- Do the results answer the question?
1082-
- Try modifying the code and the prompt to improve the code generated by the AI.
1083-
- Note: in the next practical session we will review the AI-generated code you will share the code with a colleague and they will try to run it.
1084-
6. Bonus: try setting-up Copilot or other code auto-completion system in RStudio using the documentation at
1085-
<!-- https://docs.posit.co/ide/user/ide/guide/tools/copilot.html -->
1086-
[docs.posit.co](https://docs.posit.co/ide/user/ide/guide/tools/copilot.html) or VSCode using the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) extension.
1087-
7. Bonus: share your code on GitHub, for example by pasting it into the discussion group at [github.com/ITSLeeds/TDS/discussions](https://github.com/itsleeds/tds/discussions/172) or by creating a repo on your own GitHub account.
1088-
8. Bonus: Read more about using the [tmap package](https://r-tmap.github.io/tmap/)
1089-
9. Bonus: Read more about the [ggplot2 package](https://ggplot2.tidyverse.org/)
1090-
1091-
<details>
1092-
1093-
I wrote the following prompt:
1094-
1095-
Starting with the following R code that starts by loading the tidyverse and stats19 R packages, write a script that finds out which local authorities saw the greatest percentage point decrease in the number of road traffic collisions between 2019 and 2020.
1096-
Explore this relationship for the total number of collisions with summary statistics, ggplot2 visualisations, and perhaps a basic model. Furthermore, explore how the % change in collision numbers vary depending on factors such as urban or rural area, casualty severity, and the month used for comparison.
1097-
1098-
```{r}
1099-
#| eval: false
1100-
library(tidyverse)
1101-
library(stats19)
1102-
collisions_2019 = get_stats19(2019)
1103-
collisions_2020 = get_stats19(2020)
1104-
collisions_combined = bind_rows(
1105-
mutate(collisions_2019, year = 2019),
1106-
mutate(collisions_2020, year = 2020)
1107-
)
1108-
# names(collisions_2020)
1109-
# [1] "accident_index"
1110-
# [2] "accident_year"
1111-
# [3] "accident_reference"
1112-
# [4] "location_easting_osgr"
1113-
# [5] "location_northing_osgr"
1114-
# [6] "longitude"
1115-
# [7] "latitude"
1116-
# [8] "police_force"
1117-
# [9] "accident_severity"
1118-
# [10] "number_of_vehicles"
1119-
# [11] "number_of_casualties"
1120-
# [12] "date"
1121-
# [13] "day_of_week"
1122-
# [14] "time"
1123-
# [15] "local_authority_district"
1124-
# [16] "local_authority_ons_district"
1125-
# [17] "local_authority_highway"
1126-
# [18] "first_road_class"
1127-
# [19] "first_road_number"
1128-
# [20] "road_type"
1129-
# [21] "speed_limit"
1130-
# [22] "junction_detail"
1131-
# [23] "junction_control"
1132-
# [24] "second_road_class"
1133-
# [25] "second_road_number"
1134-
# [26] "pedestrian_crossing_human_control"
1135-
# [27] "pedestrian_crossing_physical_facilities"
1136-
# [28] "light_conditions"
1137-
# [29] "weather_conditions"
1138-
# [30] "road_surface_conditions"
1139-
# [31] "special_conditions_at_site"
1140-
# [32] "carriageway_hazards"
1141-
# [33] "urban_or_rural_area"
1142-
# [34] "did_police_officer_attend_scene_of_accident"
1143-
# [35] "trunk_road_flag"
1144-
# [36] "lsoa_of_accident_location"
1145-
# [37] "enhanced_severity_collision"
1146-
# [38] "datetime"
1147-
```
1148-
1149-
</details>
1079+
2. Bonus: Read more about using the [tmap package](https://r-tmap.github.io/tmap/)
1080+
3. Bonus: Read more about the [ggplot2 package](https://ggplot2.tidyverse.org/)
11501081

11511082
# References

0 commit comments

Comments
 (0)