This file contains R code and data to run the analysis for the article:
Malaj, E., and Morrissey CA. (2021). Increased reliance on insecticide applications in Canada linked to simplified agricultural landscapes Ecological Applications
To run this analysis the files listed below are required.
- Main raw data:
findatCD.RData
in folder data. CleanCensusDat repo explains the data clean process used; - Spatial Data #1:
camapF2.RData
is a fortified Canada polygon file produced by running the codeCanada_map_plot.R
in folder supportCode. Run that file, save it ascamapF2.RData
and then continue with the points below; - Spatial Data #2: download the shapefile
2016CD_ag.shp
from repo explore_agrochemicals; - Spatial Data #3:
pud_insecticides.RData
is a raster file of spatial distribution of insecticide use density as produced in Malaj et al. (2020): https://doi.org/10.1016/j.scitotenv.2019.134765. Data is produced in a similar way as the repo SpatialAnalysis_Mapping; - Land Use Data: The csv files
aafc_crop_classifications.csv
,landuseCDCensus2010.csv
,landuseCDCensus2015.csv
andSemiNatural.csv
are all used for the analysis incorrelationsIndex.R
; - Code #1:
INLA_models.R
the main R code to run the analysis and produce figures and tables for the Bayesian models; - Code #2:
correlationsIndex.R
R code to run the formatting, extraction and plotting of the correlation between proportion of cropland and proportion of semi-natural habitats, and linear relationship between insecticide area (ha) and insecticide mass (kg); - Code #3: Java code to produce
SemiNatural.csv
data which was used in codecorrelationsIndex.R
- Support functions: three R code files in folder supportCode to help run the main analysis in code
INLA_models.R
.
Folder figures
contains all figures generated from this analyis.
R version 4.0.3
Packages: tidyverse, doBy, INLA, rgdal, raster, spdep, egg, cowplot, plyr, glmmTMB, DHARMa, emmeans, MCMCglmm, coda, ape