Skip to content

Commit 7c2ff22

Browse files
committed
Module 6 ready
1 parent 51768de commit 7c2ff22

File tree

3 files changed

+50
-16
lines changed

3 files changed

+50
-16
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: BioDataScience3
2-
Version: 2025.5.0
2+
Version: 2025.6.0
33
Title: A Series of Learnr Documents for Biological Data Science 3
44
Description: Interactive documents using learnr for studying biological data science (second course).
55
Authors@R: c(

NEWS.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
# BioDataScience3 2025.6.0
2+
3+
- Revision of **C06La_map** for 2025-2026 (still non C06Lb_interp).
4+
15
# BioDataScience3 2025.5.0
26

3-
- Revision of **C05La_ts_filter** and **C05La_ts_decomp** for 2025-2026.
7+
- Revision of **C05La_ts_filter** and **C05Lb_ts_decomp** for 2025-2026.
48

59
# BioDataScience3 2025.4.0
610

7-
- Revision of **C04La_ts_intro** for 2025-2026.
11+
- Revision of **C04La_ts_intro** for 2025-2026 (still no C04Lb_ts_analysis).
812

913
# BioDataScience3 2025.3.1
1014

inst/tutorials/C06La_map/C06La_map.Rmd.inactivated renamed to inst/tutorials/C06La_map/C06La_map.Rmd

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,40 @@ runtime: shiny_prerendered
1515
```{r setup, include=FALSE}
1616
BioDataScience3::learnr_setup()
1717
SciViews::R("spatial")
18+
# Required for RSConnect
19+
# SciViews::R
20+
library(rlang)
21+
library(data.table)
22+
library(ggplot2)
23+
library(tibble)
24+
library(tidyr)
25+
library(dplyr)
26+
library(dtplyr)
27+
library(broom)
28+
library(forcats)
29+
library(collapse)
30+
library(fs)
31+
library(data.trame)
32+
library(svFast)
33+
library(svTidy)
34+
library(svMisc)
35+
library(svBase)
36+
library(svFlow)
37+
library(data.io)
38+
library(chart)
39+
library(tabularise)
40+
library(SciViews)
41+
# ... more
42+
library(ggspatial)
43+
library(sf)
44+
library(abind)
45+
library(stars)
46+
library(terra)
47+
library(tmap)
48+
library(testthat)
49+
1850
1951
read("NLD_prov", package = "tmap") %>.%
20-
fselect(., name, population, geometry) %>.%
2152
st_as_sf(.) ->
2253
nld
2354
@@ -137,7 +168,6 @@ theme = theme_svmap, env = parent.frame()) {
137168

138169
```{r, echo=TRUE}
139170
read("NLD_prov", package = "tmap") %>.%
140-
fselect(., name, population, geometry) %>.%
141171
st_as_sf(.) ->
142172
nld
143173
nld
@@ -193,7 +223,7 @@ grade_code("Comme pour les autres graphiques ggplot2/chart, le remplissage se fa
193223

194224
```{r}
195225
chart(data = nld) +
196-
geom_sf(aes(fill = population))
226+
geom_sf(aes(fill = code))
197227
```
198228

199229
Refaites la carte ci-dessus, mais maintenant *sans* utiliser l'interface formule dans `chart()`, mais en spécifiant les paramètres dans `geom_sf()`.
@@ -206,7 +236,7 @@ ___(___ = ___) +
206236
```{r chartmap3-solution}
207237
## Solution ##
208238
chart(data = nld) +
209-
geom_sf(aes(fill = population))
239+
geom_sf(aes(fill = code))
210240
```
211241

212242
```{r chartmap3-check}
@@ -233,7 +263,7 @@ plot(st_geometry(nld))
233263
```
234264

235265
```{r basemap1-check}
236-
grade_code("La fonction `sf_geometry()` extrait l'info nécessaire de l'objet **sf** dans ce cas.")
266+
grade_code("La fonction `st_geometry()` extrait l'info nécessaire de l'objet **sf** dans ce cas.")
237267
```
238268

239269
Le code R de base est bien plus rapide que les cartes réalisées avec `chart()`(ou `ggplot()`). Cette remarque est valable pour tous les types de graphiques entre les deux moteurs graphiques.
@@ -267,22 +297,22 @@ grade_code("Notez la similitude entre `chart()` et `tmap()` auxquels on ajoute d
267297
```{r}
268298
tm_shape(nld) +
269299
tm_borders() +
270-
tm_fill("name", title = "Province")
300+
tm_fill("name", fill.legend = tm_legend(title = "Province"))
271301
```
272302

273303
Reproduisez la carte ci-dessus avec le package {tmap} en modulant les arguments des fonctions utilisées et en ajoutant une couche de remplissage.
274304

275305
```{r tmap2, exercise=TRUE, exercise.lines=3}
276306
tm_shape(___) +
277307
tm_borders() +
278-
tm_fill(___, title = ___)
308+
tm_fill(___, fill.legend = tm_legend(title = ___))
279309
```
280310

281311
```{r tmap2-solution}
282312
## Solution ##
283313
tm_shape(nld) +
284314
tm_borders() +
285-
tm_fill("name", title = "Province")
315+
tm_fill("name", fill.legend = tm_legend(title = "Province"))
286316
```
287317

288318
```{r tmap2-check}
@@ -292,9 +322,9 @@ grade_code("Le remplissage des polygones se fait effectivement en ajoutant une c
292322
```{r}
293323
tm_shape(nld) +
294324
tm_borders() +
295-
tm_fill("name", title = "Province") +
325+
tm_fill("name", fill.legend = tm_legend(title = "Province")) +
296326
tm_compass() +
297-
tm_scale_bar(position = c("left", "bottom"))
327+
tm_scalebar(position = c("left", "bottom"))
298328
```
299329

300330
À présent, tentez de reproduire une carte un peu plus complexe en cinq couches, toujours avec le package {tmap}. Partez de la solution de l'exercice précédent que vous complétez.
@@ -308,7 +338,7 @@ tm_shape(nld) +
308338
```{r tmap3, exercise=TRUE, exercise.lines=6}
309339
tm_shape(nld) +
310340
tm_borders() +
311-
tm_fill("name", title = "Province") +
341+
tm_fill("name", fill.legend = tm_legend(title = "Province")) +
312342
___() +
313343
___(position = c(___, ___))
314344
```
@@ -317,9 +347,9 @@ tm_shape(nld) +
317347
## Solution ##
318348
tm_shape(nld) +
319349
tm_borders() +
320-
tm_fill("name", title = "Province") +
350+
tm_fill("name", fill.legend = tm_legend(title = "Province")) +
321351
tm_compass() +
322-
tm_scale_bar(position = c("left", "bottom"))
352+
tm_scalebar(position = c("left", "bottom"))
323353
```
324354

325355
```{r tmap3-check}

0 commit comments

Comments
 (0)