edmaps
is best used in reproducible workflows powered by
drake
, with each step explicitly
represented within a plan. Plans specify R expressions (commands) and
targets that will store the commands' returned value. The process of
estimating establishment likelihood begins with the preparation of core datasets
that are used across species. Subsequent targets relate to individual species
to be assessed.
A pair of functions has been included to facilitate generation of these drake
plans.
species_plan()
: Given a set of user inputs, the output of species_plan
is
a new drake plan that contains the targets required to estimate risk for
the species, as well as the preliminary data wrangling steps. excel_to_plan()
: This function provides a simple way to generate plans for
species, and is particularly useful for generating plans for multiple species as
a batch. It is used by providing the path to a Microsoft Excel xlsx file
containing parameter values for one or more species (example at the path given
by system.file('extdata/parameters.xlsx', package='edmaps')
), in which each
row of the xlsx corresponds to a species, and columns contain parameters
relating to the species. When called, excel_to_plan
imports and parses the
xlsx file, and then iterates over species, passing the appropriate arguments to
species_plan
and combining the resulting plans.Plans generated by the above processes (as demonstrated below) can then be
built using drake::make(plan)
.
A plan defining the steps involved in risk estimation for Bactrocera dorsalis
can be created using species_plan
as follows:
library(edmaps)
dorsalis <- species_plan( species='Bactrocera dorsalis', aggregated_res=c(10000, 10000), clum_path='data/biotic/raw_data/ACLUM/clum_50m1218m.tif', nvis_path='data/edmaps/biotic/raw_data/NVIS_5.1/aus5_1e_mvs', ndvi_path='data/edmaps/biotic/raw_data/NDVI/NDVI_Oct18_Mar19.grid', fertiliser_data_path='data/edmaps/pathway/raw_data/Fertiliser/fertiliser2016_17.csv', nrm_path='data/edmaps/pathway/raw_data/Fertiliser/nrm_regions/NRMR_2016_AUST.shp', containers_data_path='data/edmaps/pathway/raw_data/Containers/containers_bypostcode.xls', postcode_path='data/edmaps/pathway/raw_data/Containers/postal_areas/POA_2011_AUST.shp', airports_path='data/edmaps/pathway/raw_data/Major_Airports/MajorAviationTerminals.gdb', tourist_beds_path='data/edmaps/pathway/raw_data/Tourist_Beds2016/TourBedsAlbers1km.shp', pop_density_path='data/edmaps/pathway/raw_data/Population2016/pop_density_1000m.tif', processed_data_path='data/processed', clum_classes=c(340, 341, 342, 344, 345, 347, 348, 349, 350, 351, 353, 365, 440, 441, 442, 444, 445, 447, 448, 449, 450, 451, 453, 540, 541, 542, 543, 544), pathways=c('tourists', 'residents', 'torres'), include_abiotic_weight=TRUE, occurrence_path='data/abiotic/occurrences/oriental_fruitfly/dorsalis_occurrences.csv', cabi_path='data/abiotic/occurrences/oriental_fruitfly/cabi_dorsalis_20April19.csv', use_gbif=TRUE, manual_check_flagged_records=FALSE, gbif_species=c("Bactrocera dorsalis","Bactrocera invadens", "Bactrocera papayae", "Bactrocera philippinensis"), leakage_tourists=c(7, 67), establishment_tourists=c(0.001, 0.01), leakage_returning=c(3, 33), establishment_returning=c(0.001, 0.01), leakage_torres=c(1, 100), establishment_torres=c(0.001, 0.01))
# Let's take a look dorsalis # List the targets dorsalis$target
To create a plan for multiple species, it is simpler to use excel_to_plan
.
Using the example xlsx file included with edmaps
, we can prepare a plan for
four species: oriental fruitfly, khapra beetle, brown marmorated stink bug and
gypsy moth. Below, we point excel_to_plan
to that file. Note that this
example requires a number of raw data files that are not distributed with the
edmaps
package.
f <- system.file('extdata/parameters.xlsx', package='edmaps') all <- excel_to_plan(f) # Let's take a look all # List the targets all$target
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.