source("XX_setup.R")
<- read_csv("Data/03_Final/transitions_final.csv") |>
trans left_join(read_csv("Data/03_Final/summary_birds.csv"),
by = c("tagDeployID", "english")) |>
filter(travelled) |>
mutate(month = month(mid_date)) |>
mutate(n = n_distinct(tagDeployID), .by = "english") |>
arrange(desc(n))
Maps
This script produces maps by species and by individuals for birds who moved at least 100km (travelled
, see Summaries).
Setup
Maps by species
Code
walk(unique(trans$speciesID), \(x) {
<- filter(trans, speciesID == x)
t1 <- ggplot(t1, aes(x = lon1, y = lat1)) +
g annotation_map_tile(type = "cartolight", zoomin = 0) +
geom_spatial_segment(
aes(xend = lon2, yend = lat2, colour = month),
arrow = arrow(length = unit(10, "pt"), type = "closed"), crs = 4326, na.rm = TRUE) +
scale_colour_viridis_c(option = "inferno",
begin = 0.20, end = 0.85) +
guides(colour = guide_colourbar(reverse = TRUE)) +
labs(title = t1$english[1],
subtitle = paste0("n = ", n_distinct(t1$tagDeployID), "; ", as_date(min(t1$b1)), " to ", as_date(max(t1$e2))))
cat(paste0("\n\n### ", t1$english[1], "\n\n"))
print(g)
})
Swainson’s Thrush
Ovenbird
Hermit Thrush
Song Sparrow
Yellow-rumped Warbler (Myrtle)
Chestnut-collared Longspur
Purple Finch
Tennessee Warbler
Magnolia Warbler
Red-eyed Vireo
Sprague’s Pipit
Western Meadowlark
Gray Catbird
White-throated Sparrow
Golden-crowned Sparrow
Blue-headed Vireo
Pine Siskin
Spotted Towhee
Northern Cardinal
Lazuli Bunting
Baird’s Sparrow
Black-throated Blue Warbler
Common Yellowthroat
Northern Waterthrush
Horned Lark
Maps by individual
Code
walk(unique(trans$speciesID), \(x) {
cat(paste0("\n\n### ", trans$english[trans$speciesID == x][1], "\n\n"))
walk(unique(trans$tagDeployID[trans$speciesID == x]), \(y) {
<- filter(trans, tagDeployID == y)
t1 <- plot_map(trans, y, pad = FALSE, lowres = TRUE) +
g labs(title = paste0(t1$english[1], " - ", t1$tagDeployID[1]),
subtitle = paste0(min(t1$b1), " to ", max(t1$e2)))
cat(paste0("\n\n#### ", t1$tagDeployID[1], "\n\n"))
print(g)
}) })
Swainson’s Thrush
13854
13850
14299
13844
13845
13847
13846
13852
14164
13859
14163
14162
14167
14161
18877
18916
17852
18548
19419
17854
19420
17856
18880
19412
18885
19421
19972
18894
18886
19973
18881
18897
17853
18899
19975
19410
18890
18912
18904
18902
17695
18903
19971
18900
19970
18901
18914
18910
17671
19414
17672
18913
19417
18915
18911
25876
26121
28168
29458
29547
25521
29548
30180
29549
30119
30142
33362
35290
35734
35737
35307
35740
29918
35731
35733
35732
35914
35915
36320
36319
35605
35916
36315
36317
35486
35485
36316
36995
36500
36311
36321
35911
36314
36318
36313
36994
35306
36998
36312
36993
36997
35739
42753
42755
42749
42751
41683
41826
42476
42756
42787
42474
42244
41580
41676
41673
42752
42750
42974
42970
42900
42899
42971
42902
42475
42896
43067
42973
43149
41657
41579
41700
42002
41678
41677
41682
43016
42975
43065
42898
43066
Warning: ggrepel: 4 unlabeled data points (too many overlaps). Consider
increasing max.overlaps
42969
42972
41674
42242
41680
42001
41675
43426
42243
43427
42241
43929
Warning: ggrepel: 7 unlabeled data points (too many overlaps). Consider
increasing max.overlaps
44111
45239
49421
Warning: ggrepel: 1 unlabeled data points (too many overlaps). Consider
increasing max.overlaps
49420
49578
49418
49423
49422
49424
49583
Warning: ggrepel: 6 unlabeled data points (too many overlaps). Consider
increasing max.overlaps