Skip to content

Commit

Permalink
Add selected species that were analysed for ABV. Add red list data Fl…
Browse files Browse the repository at this point in the history
…anders.
  • Loading branch information
EmmaCartuyvels1 committed Oct 29, 2024
1 parent 59c526d commit f822dec
Showing 1 changed file with 107 additions and 0 deletions.
107 changes: 107 additions & 0 deletions source/trend_mod.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
title: '"Trend modelling"'
author: "Emma Cartuyvels, Ward Langeraert, Toon Van Daele"
date: "2024-10-29"
output: html_document
---

```{r setup, include=FALSE}
library(tidyverse)
knitr::opts_chunk$set(echo = TRUE)
```

```{r data, cache=TRUE}
birdcubeflanders_year_sf <- read_sf(here::here("data", "interim",
"birdcubeflanders_year.gpkg"))
abv_data_total_sf <- read_sf(here::here("data", "interim",
"abv_data_total.gpkg"))
```

```{r transform abv}
abv_data_total <- abv_data_total_sf |>
st_drop_geometry() |>
mutate(cyclus = case_when(
year >= 2007 & year <= 2009 ~ 1,
year >= 2010 & year <= 2012 ~ 2,
year >= 2013 & year <= 2015 ~ 3,
year >= 2016 & year <= 2018 ~ 4,
year >= 2019 & year <= 2021 ~ 5,
year >= 2022 & year <= 2024 ~ 6
)) |>
mutate(species = case_when(
species == "Parus montanus" ~ "Poecile montanus",
species == "Dendrocopus major" ~ "Dendrocopos major",
species == "Saxicola torquatus" ~ "Saxicola rubicola",
TRUE ~ species
)) |>
group_by(species) |>
mutate(n_obs = n()) |>
ungroup() |>
mutate(category = cut(n_obs,
breaks = c(0, 10, 100, 1000, 10000, +Inf),
labels = c("Very rare", "Rare", "Common",
"Very common", "Extremely common"),
right = FALSE))
birdcubeflanders_year <- birdcubeflanders_year_sf |>
st_drop_geometry() |>
mutate(cyclus = case_when(
year >= 2007 & year <= 2009 ~ 1,
year >= 2010 & year <= 2012 ~ 2,
year >= 2013 & year <= 2015 ~ 3,
year >= 2016 & year <= 2018 ~ 4,
year >= 2019 & year <= 2021 ~ 5,
year >= 2022 & year <= 2024 ~ 6
))
abv_data_total_tf <- abv_data_total |>
group_by(species, year, TAG, category) |>
summarise(n = sum(individualCount)) |>
ungroup()
```

```{r}
abv_ana_birds <- c(
"Cetti's zanger", "Putter", "Kleine mantelmeeuw", "Roek", "Kuifeend",
"Halsbandparkiet", "Aalscholver", "Kauw", "Buizerd", "Nijlgans",
"Roodborsttapuit", "Boomklever", "Meerkoet", "Zwarte roodstaart",
"Grote bonte specht", "Roodborst", "Krakeend", "Boomleeuwerik",
"Bonte vliegenvanger", "Grauwe gans", "Torenvalk", "Zwartkop",
"Witte kwikstaart", "Boomkruiper", "Grasmus", "Pimpelmees", "Vink",
"Boerenzwaluw", "Tjiftjaf", "Zwarte kraai", "Houtduif", "Kleine karekiet",
"Fazant", "Gaai", "Groene specht", "Ekster", "Koolmees", "Gele kwikstaart",
"Groenling", "Holenduif", "Winterkoning", "Scholekster", "Koekoek",
"Heggenmus", "Spreeuw", "Turkse tortel", "Veldleeuwerik", "Geelgors",
"Goudhaan", "Kuifmees", "Zilvermeeuw", "Matkop", "Huismus", "Wilde eend",
"Waterhoen", "Zanglijster", "Merel", "Tuinfluiter", "Zwarte mees", "Patrijs",
"Graspieper", "Fitis", "Stadsduif", "Wielewaal", "Grutto", "Kievit",
"Grote lijster", "Ringmus", "Sprinkhaanzanger", "Kokmeeuw", "Sperwer",
"Bruine kiekendief", "Fuut", "Gekraagde roodstaart", "Bergeend", "Kneu",
"Rietzanger", "Blauwe reiger", "Wulp", "Blauwborst", "Zwarte specht",
"Boompieper", "Rietgors", "Canadese gans", "Spotvogel", "Bosrietzanger",
"Knobbelzwaan", "Havik", "Glanskop", "Middelste Bonte Specht", "Tafeleend",
"Gierzwaluw", "Nachtegaal", "Huiszwaluw", "Staartmees", "Dodaars"
)
abv_ana_birds <- data.frame(abv_ana_birds) |>
left_join(abv_data_total |> distinct(vernacularName, species),
by = join_by(abv_ana_birds == vernacularName))
```

```{r}
data_path <- here::here("data", "raw")
red_list_fl1 <- read_delim(file.path(data_path,
"dwca-rl-flanders-validated-checklist-v1.7",
"distribution.txt"),
delim = "\t",
show_col_types = FALSE)
red_list_fl2 <- read_delim(file.path(data_path,
"dwca-rl-flanders-validated-checklist-v1.7",
"taxon.txt"),
delim = "\t",
show_col_types = FALSE)
```

0 comments on commit f822dec

Please sign in to comment.