diff --git a/docs/404.html b/docs/404.html index 84888db..e23cf00 100644 --- a/docs/404.html +++ b/docs/404.html @@ -23,7 +23,7 @@ - + @@ -134,8 +134,7 @@
# bind all spatially and temporally thinned absences rows for data frame
dataSubsample <- bind_rows(dataSubsample)
@@ -503,7 +502,7 @@ 8.3.1 Count absences after tempor
8.4 Add checklist calibration index
Load the CCI computed in the previous section. The CCI was the lone observer’s expertise score for single-observer checklists, and the highest expertise score among observers for group checklists.
# read in obs score and extract numbers
-expertiseScore <- read_csv("data/03_data-obsExpertise-score.csv") %>%
+expertiseScore <- read_csv("results/04_data-obsExpertise-score.csv") %>%
mutate(numObserver = str_extract(observer, "\\d+")) %>%
dplyr::select(-observer)
@@ -641,7 +640,7 @@ 8.7.3 Link environmental covariat
)
Save data to file.
+write_csv(dataSubsample, path = glue("results/08_data-covars-2.5km.csv"))
Here we load filtered checklist data and convert to UTM 43N coordinates.
# load checklist data
-load("data/01_data_prelim_processing.rdata")
+load("results/02_data_prelim_processing.rdata")
# get checklists
data <- distinct(
diff --git a/docs/examining-spatial-sampling-bias.html b/docs/examining-spatial-sampling-bias.html
index 442fcc4..72e2880 100644
--- a/docs/examining-spatial-sampling-bias.html
+++ b/docs/examining-spatial-sampling-bias.html
@@ -23,7 +23,7 @@
-
+
@@ -134,8 +134,7 @@
- 1 Introduction
- 2 Selecting species of interest
- 2.1 Prepare libraries
@@ -327,7 +326,7 @@ 6.1 Prepare libraries
6.2 Read checklist data
Read in checklist data with distance to nearest neighbouring site, and the distance to the nearest road.
+chkCovars <- read_csv("results/04_data-covars-perChklist.csv")
We filter the checklists by the boundary of the study area. This is not the extent.
@@ -383,7 +382,7 @@2022-04-26
+2022-04-28
This is the readable version containing analysis that models associations between environmental predictors (climate and landcover) and citizen science observations of birds across the Nilgiri and Anamalai Hills of the Western Ghats Biodiversity Hotspot.
+This is the readable version containing analysis that models associations between environmental predictors (climate and landcover) and citizen science observations of birds across the Nilgiri and Anamalai Hills of the Western Ghats Biodiversity hotspot.
Methods and format are derived from https://cornelllabofornithology.github.io/ebird-best-practices/.
-The data used in this work are available from eBird.
-The data processing for this project is described in the following sections. Navigate through them using the links in the sidebar.
Here, we load the required dataframe that contains 10 random visits to a site and environmental covariates that were prepared at a spatial scale of 2.5 sq.km. We also scaled all covariates (mean around 0 and standard deviation of 1). Next, we ensured that only Traveling and Stationary checklists were considered. Even though stationary counts have no distance traveled, we defaulted all stationary accounts to an effective distance of 100m, which we consider the average maximum detection radius for most bird species in our area.
# Load in the prepared dataframe
-dat <- fread("data/04_data-covars-2.5km.csv", header = T)
+dat <- fread("results/08_data-covars-2.5km.csv", header = T)
dat <- as_tibble(dat)
head(dat)
# Reload the scaled covariate data
-dat.scaled <- fread("data/05_scaled-covars-2.5km.csv", header = T)
+dat.scaled <- fread("results/09_scaled-covars-2.5km.csv", header = T)
dat.scaled <- as_tibble(dat.scaled)
head(dat.scaled)
@@ -564,7 +563,7 @@ 9.2 Running a null model
close(pb)
# Store all the model outputs for each species
-capture.output(all_null, file = "data/results/null_models.csv")
# read coefficient effect data
-data <- read_csv("data/results/data_predictor_effect.csv")
+data <- read_csv("results/10_data-predictor-effect.csv")
# check for a predictor column
assertthat::assert_that(
diff --git a/docs/preparing-checklist-calibration-index.html b/docs/preparing-checklist-calibration-index.html
index bcfb76d..cb445bd 100644
--- a/docs/preparing-checklist-calibration-index.html
+++ b/docs/preparing-checklist-calibration-index.html
@@ -23,7 +23,7 @@
-
+
@@ -134,8 +134,7 @@
- 1 Introduction
- 2 Selecting species of interest
- 2.1 Prepare libraries
@@ -409,7 +408,7 @@ 5.3 Spatially explicit filter on
5.4 Prepare species of interest
# read in species list
-specieslist <- read.csv("data/species_list.csv")
+specieslist <- read.csv("data/species-list.csv")
# set species of interest
soi <- specieslist$scientific_name
@@ -422,7 +421,7 @@ 5.4 Prepare species of interest
]
# write to file and link with checklist id later
-fwrite(ebdSpSum, file = "data/03_data-nspp-per-chk.csv")
+fwrite(ebdSpSum, file = "results/04_data-nspp-per-chk.csv")
# make dir if absent
-if (!dir.exists("data/modOutput")) {
- dir.create("data/modOutput")
+if (!dir.exists("results/modOutput")) {
+ dir.create("results/modOutput")
}
# write model output to text file
{
writeLines(R.utils::captureOutput(list(Sys.time(), summary(modObsExp))),
- con = "data/modOutput/03_model-output-expertise.txt"
+ con = "results/modOutput/04_model-output-expertise.txt"
)
}
# make df with means
@@ -582,7 +581,7 @@ 5.8 Model observer expertise
) %>%
mutate(score = scales::rescale(score))
fwrite(dfPredict %>% dplyr::select(observer, score),
- file = "data/03_data-obsExpertise-score.csv"
+ file = "results/04_data-obsExpertise-score.csv"
)
Insert the list of species that we will be analyzing in this study. We initially chose those species that occurred in at least 5% of all checklists across 50% of the 25 x 25 km cells from where they have been reported, resulting in a total of 79 species. To arrive at this final list of species, we carried out further pre-processing which can be found in the previous script.
For further details regarding the list of species, please refer to the main text of the manuscript.
# add species of interest
-specieslist <- read.csv("data/species_list.csv")
+specieslist <- read.csv("data/species-list.csv")
speciesOfInterest <- as.character(specieslist$scientific_name)
Here, we set broad spatial filters for the states of Kerala, Tamil Nadu and Karnataka and keep only those checklists for our list of species that were reported between 1st Jan 2013 and 31st May 2021.
Save temporary data created so far.
+save(data, file = "results/02_data_temp.rdata")The above data is saved to a file.
+save(dataGrouped, file = "results/02_data_prelim_processing.Rdata") diff --git a/docs/preparing-environmental-predictors.html b/docs/preparing-environmental-predictors.html index 32c3911..499a981 100644 --- a/docs/preparing-environmental-predictors.html +++ b/docs/preparing-environmental-predictors.html @@ -23,7 +23,7 @@ - + @@ -134,8 +134,7 @@In this script, we processed climatic and landscape predictors for occupancy modeling.
All climatic data was obtained from https://chelsa-climate.org/bioclim/
-All landscape data was derived from a high resolution land cover map (Roy et al. 2015). This map provides sufficient classes to achieve a high land cover resolution and can be accessed here (https://daac.ornl.gov/VEGETATION/guides/Decadal_LULC_India.html)
The goal here is to resample all rasters so that they have the same resolution of 1km cells.
# add species of interest
# please note the below script is obtained after manual subsetting based on natural history and hence the user is asked to examine the dataset obtained in the previous time step prior to further processing
-specieslist <- read.csv("data/species_list.csv")
+specieslist <- read.csv("data/species-list.csv")
speciesOfInterest <- specieslist$scientific_name
# write the new list of species that occur in at least 5% of checklists across a minimum of 50% of the grids they have been reported in
new_sp_list <- semi_join(specieslist, grid_prop_cut, by = "scientific_name")
-write_csv(new_sp_list, "data/01_list-of-species-cutoff.csv")
# which files to read
-file_names <- c("data/results/lc-clim-imp.xlsx")
+file_names <- c("results/09_lc-clim-imp.xlsx")
# read in sheets by species
model_imp <- map(file_names, function(f) {
@@ -399,10 +398,10 @@ 10.3.2 Prepare cumulative AIC wei
)
# write to file
-write_csv(model_imp, "data/results/cumulative_AIC_weights.csv")
Read data back in.
# read data and make factor
-model_imp <- read_csv("data/results/cumulative_AIC_weights.csv")
+model_imp <- read_csv("results/10_cumulative-AIC-weights.csv")
model_imp$predictor <- as_factor(model_imp$predictor)
# make nice names
predictor_name <- tibble(
@@ -424,7 +423,7 @@ 10.3.2 Prepare cumulative AIC wei
10.4 Prepare model coefficient data
For each species, we examined those models which had ΔAICc < 4, as these top models were considered to explain a large proportion of the association between the species-specific probability of occupancy and environmental drivers. Using these restricted model sets for each species; we created a model-averaged coefficient estimate for each predictor and assessed its direction and significance. We considered a predictor to be significantly associated with occupancy if the range of the 95% confidence interval around the model-averaged coefficient did not contain zero.
-file_read <- c("data/results/lc-clim-modelEst.xlsx")
+file_read <- c("results/09_lc-clim-modelEst.xlsx")
# read data as list column
model_est <- map(list_of_species, function(sn) {
@@ -498,7 +497,7 @@ 10.4 Prepare model coefficient da
)
# write to file
-write_csv(data_predictor_effect, "data/results/data_predictor_effect.csv")
+write_csv(data_predictor_effect, "results/10_data-predictor-effect.csv")
Export model data.
model_data_to_file <- model_data %>%
dplyr::select(
@@ -512,22 +511,22 @@ 10.4 Prepare model coefficient da
write_csv(
model_data_to_file,
- "data/results/data_occupancy_predictors.csv"
+ "results/10_data-occupancy-predictors.csv"
)
Read in data after clearing R session.
# first merge species trait data with significant predictor
species_trait <- read.csv("data/species-trait-dat.csv")
-sig_predictor <- read.csv("data/results/data_predictor_effect.csv")
+sig_predictor <- read.csv("results/10_data-predictor-effect.csv")
merged_species_traits <- inner_join(sig_predictor, species_trait,
by = c("scientific_name" = "scientific_name")
)
write_csv(
merged_species_traits,
- "data/results/results-predictors-species-traits.csv"
+ "results/10_results-predictors-species-traits.csv"
)
# read from file
-model_data <- read_csv("data/results/results-predictors-species-traits.csv")
+model_data <- read_csv("results/10_results-predictors-species-traits.csv")
Fix predictor name.
# remove .y from predictors
model_data <- model_data %>%
@@ -573,7 +572,7 @@ 10.5 Get predictor effects
# write
write_csv(
data_predictor_long,
- "data/results/data_predictor_direction_nSpecies.csv"
+ "results/10_data-predictor-direction-nSpecies.csv"
)
Prepare data to determine the direction (positive or negative) of the effect of each predictor. How many species are affected in either direction?