Skip to content
Snippets Groups Projects
Commit 2ed6e4ff authored by Maria Voigt's avatar Maria Voigt
Browse files

adding an option to exclude aerial transects

when the offset is defined, only if include_aerial = T, then,
the aerial transects are joined together with other transects
parent fd294da8
No related branches found
No related tags found
No related merge requests found
...@@ -234,8 +234,21 @@ predictors_obs$y_center <- as.numeric(as.vector(scale(predictors_obs[ , ...@@ -234,8 +234,21 @@ predictors_obs$y_center <- as.numeric(as.vector(scale(predictors_obs[ ,
"unscaled_y_center"]))) "unscaled_y_center"])))
# work on aerial transects # ou density and offset term for ground and absence transects
other_predictors_obs <- filter(predictors_obs, group != "aerial")
# density
other_predictors_obs$ou_dens <- (other_predictors_obs$nr_nests/
(other_predictors_obs$length_km * ESW * 2)) *
(1/(other_predictors_obs$nest_decay * NCS * PNB))
# offset
other_predictors_obs$offset_term <- log(other_predictors_obs$length_km * ESW *
2 * other_predictors_obs$nest_decay *
NCS * PNB)
# ou density and offset term for aerial transects
if (include_aerial == T){
aerial_predictors_obs <- dplyr::filter(predictors_obs, group == "aerial") aerial_predictors_obs <- dplyr::filter(predictors_obs, group == "aerial")
# density # density
aerial_predictors_obs$ou_dens <- (aerial_predictors_obs$nr_nests/ aerial_predictors_obs$ou_dens <- (aerial_predictors_obs$nr_nests/
...@@ -246,22 +259,14 @@ aerial_predictors_obs$offset_term <- log(aerial_predictors_obs$length_km * ESW_a ...@@ -246,22 +259,14 @@ aerial_predictors_obs$offset_term <- log(aerial_predictors_obs$length_km * ESW_a
2 * aerial_predictors_obs$nest_decay * 2 * aerial_predictors_obs$nest_decay *
NCS * PNB) NCS * PNB)
# work on ground transects predictors_obs <- aerial_predictors_obs %>%
other_predictors_obs <- filter(predictors_obs, group != "aerial") bind_rows(other_predictors_obs)
# density }else{
other_predictors_obs$ou_dens <- (other_predictors_obs$nr_nests/ predictors_obs <- other_predictors_obs
(other_predictors_obs$length_km * ESW * 2)) * }
(1/(other_predictors_obs$nest_decay * NCS * PNB))
# offset
other_predictors_obs$offset_term <- log(other_predictors_obs$length_km * ESW *
2 * other_predictors_obs$nest_decay *
NCS * PNB)
names_predictors_obs <- names(other_predictors_obs)
# bind the two together # bind the two together
predictors_obs <- aerial_predictors_obs %>% predictors_obs <- predictors_obs %>%
bind_rows(other_predictors_obs) %>%
arrange(id) %>% arrange(id) %>%
dplyr::select(id, group, x_start:LU, length_km:nest_decay, dplyr::select(id, group, x_start:LU, length_km:nest_decay,
year, deforestation_gaveau:temp_mean, x_center, y_center, year, deforestation_gaveau:temp_mean, x_center, y_center,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment