3 Exercises I
\[ \newcommand{\Exp}{\mathrm{E}} \newcommand\given[1][]{\:#1\vert\:} \newcommand{\Cov}{\mathrm{Cov}} \newcommand{\Var}{\mathrm{Var}} \newcommand{\rank}{\mathrm{rank}} \newcommand{\bm}[1]{\boldsymbol{\mathbf{#1}}} \]
Required packages
Session info
R version 4.6.0 (2026-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)
Matrix products: default
LAPACK version 3.12.1
locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8
[3] LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C
[5] LC_TIME=German_Germany.utf8
time zone: Europe/Berlin
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] gridExtra_2.3 ggthemes_5.2.0 ggplot2_4.0.3
[4] viridisLite_0.4.3 tmap_4.4 spatialreg_1.4-3
[7] Matrix_1.7-5 spdep_1.4-2 spData_2.3.5
[10] areal_0.1.8 mapview_2.11.4 sf_1.1-1
loaded via a namespace (and not attached):
[1] tidyselect_1.2.1 dplyr_1.2.1
[3] farver_2.1.2 S7_0.2.2
[5] fastmap_1.2.0 leaflegend_1.2.8
[7] leaflet_2.2.3 TH.data_1.1-5
[9] XML_3.99-0.23 digest_0.6.39
[11] lifecycle_1.0.5 LearnBayes_2.15.2
[13] survival_3.8-6 terra_1.9-27
[15] magrittr_2.0.5 compiler_4.6.0
[17] rlang_1.2.0 tools_4.6.0
[19] data.table_1.18.4 knitr_1.51
[21] htmlwidgets_1.6.4 sp_2.2-1
[23] classInt_0.4-11 RColorBrewer_1.1-3
[25] multcomp_1.4-30 abind_1.4-8
[27] KernSmooth_2.23-26 purrr_1.2.2
[29] withr_3.0.2 leafsync_0.1.0
[31] grid_4.6.0 stats4_4.6.0
[33] cols4all_0.10 e1071_1.7-17
[35] leafem_0.2.5 colorspace_2.1-2
[37] spacesXYZ_1.6-0 scales_1.4.0
[39] MASS_7.3-65 cli_3.6.6
[41] mvtnorm_1.3-7 rmarkdown_2.31
[43] generics_0.1.4 otel_0.2.0
[45] rstudioapi_0.18.0 tmaptools_3.3
[47] DBI_1.3.0 proxy_0.4-29
[49] stringr_1.6.0 splines_4.6.0
[51] stars_0.7-2 parallel_4.6.0
[53] s2_1.1.11 base64enc_0.1-6
[55] marginaleffects_0.32.0 vctrs_0.7.3
[57] boot_1.3-32 sandwich_3.1-1
[59] jsonlite_2.0.0 crosstalk_1.2.2
[61] maptiles_0.11.0 units_1.0-1
[63] glue_1.8.1 lwgeom_0.2-16
[65] codetools_0.2-20 stringi_1.8.7
[67] gtable_0.3.6 deldir_2.0-4
[69] raster_3.6-32 tibble_3.3.1
[71] logger_0.4.2 pillar_1.11.1
[73] htmltools_0.5.9 satellite_1.0.6
[75] R6_2.6.1 wk_0.9.5
[77] microbenchmark_1.5.0 evaluate_1.0.5
[79] lattice_0.22-9 png_0.1-9
[81] backports_1.5.1 class_7.3-23
[83] Rcpp_1.1.1-1.1 coda_0.19-4.1
[85] nlme_3.1-169 xfun_0.57
[87] zoo_1.8-15 pkgconfig_2.0.3
Reload data from pervious session
load("_data/msoa2_spatial.RData")3.1 General Exercises
3.1.1 1) Can you import the spatial administrative units of Germany (“Kreisgrenzen_2020_mit_Einwohnerzahl” from the _data folder) and make a simple map of the geographies / adminstrative boundaries? {.unnumbered}
2) What is the Coordinate reference system of this German shape file? Please print the CRS.
4) Below we will load some additional data on heat islands.
We will add some Data about London’s Urban Heat Island. It contains information about the mean temperature at midnight during the summer of 2011.
This is a tif file that we need to read in with stars and then transform into sf.
On which projection is the urbclim temperature data?
Can you please calculate the average night-time temperature for each MSOA using area weighted interpolation. Make sure that the objects are on the same projections / crs.
Create a map showing the temperature for each MSOA, and plot it next to the maps of non-EU immigrant residents (e.g. using
grid.arrange()) .