Description Usage Arguments Value Examples
View source: R/FunctionMultiBNG.R
This function is to carry out modelling of multiple species using the JNCCSdms package.
1 2 3 4 5 6 | MultiBNG(sp_list = sp_list, out_flder = "Outputs/", dat_flder,
bkgd_flder, vars, max_tries = 1, datafrom = "NBNatlas",
minyear = 0, maxyear = 0, mindata = 5000, covarRes = 300,
models = c("MaxEnt", "BioClim", "SVM", "RF", "GLM", "GAM", "BRT"),
prop_test_data = 0.25, bngCol = "OSGR", mult_prssr = FALSE,
rndm_occ = TRUE)
|
sp_list |
List of unique species names which you wish to model. |
out_flder |
The location of the output folder for your models. |
dat_flder |
The location of the folder containing your species occurrence data, as txt or csv files exported from NBN gateway or NBN atlas. Each file should contain data for a single species and the naming convention should correspond to your species list in order to be recognised. e.g. 'Triturus cristatus' in the sp_list should have a corresponding data file named 'Triturus cristatus.csv' in the dat_folder. |
bkgd_flder |
The location of the folder containing your background masks. These should be raster files showing the background area in which pseudo-absence points will be placed. Cells from which background points should be taken should have a value of 1 and excluded cells should be NA. This should be named after the Taxon Group e.g. 'amphibian' and if this is not found in the data by a 'taxonGroup' variable, then pseudo absences with be generated from the variables layer. |
vars |
A RasterStack of the environmental parameters to be used as predictor variables for the species range. |
max_tries |
The number of times the number is run. |
datafrom |
Whether it is data from the 'NBNgateway' or 'NBNatlas'. |
minyear |
Numeric, the earliest year from which data should be selected. Year inclusive, data older than this will be discarded. |
maxyear |
Numeric, the latest year from which data should be used. Year inclusive, data newer than this will be discarded. |
mindata |
The target minimum number of data points to return. If this is specified, the lowest resolution data will be discarded if there are enough higher resolution data points available to reach this target. |
covarRes |
The resolution of the environmental covariate data layers, in metres. Data will not be discarded if it is of higher resolution than the environmental covariate layers. |
models |
A character vector of the models to run and evaluate. This should be at least one of |
prop_test_data |
Numeric, the proportion of data to keep back as testing data for evaluating the models. Default is 25%. |
bngCol |
The column name of the column in |
mult_prssr |
Set up a parallel backend to use multiple processors. As a default this is turned off. Need to ensure the suggested packages have been loaded in order to run this. |
rndm_occ |
Logical, Default is TRUE and will randomise the locations of presence points where the species occurrence data is low resolution, through calling the randomOcc function. |
Lists containing predictions from the best models (as a raster layer showing probability of species occurrence), the best model evaluations and the best model itself for each species in a given species list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #Provide a list of species you wish to model
sp_list <- c("Notonecta_glauca", "Sigara_dorsalis")
#Organise an Input folder containing your input species files as .csv
dir.create("Inputs")
data("ng_data")
data("sd_data")
utils::write.csv(ng_data, file = "./Inputs/Notonecta_glauca.csv")
utils::write.csv(ng_data, file = "./Inputs/Sigara_dorsalis.csv")
#Organise a folder containing your background masks where your pseudo absences will be generated from.
dir.create("BGmasks")
data("background")
save(background, file = "./BGmasks/Hemiptera")
#Create outputs folder
dir.create("Outputs")
#Get variables data from worldclim
#get UK extent
UK <- ggplot2::map_data(map = "world", region = "UK")
max.lat <- ceiling(max(UK$lat))
min.lat <- floor(min(UK$lat))
max.lon <- ceiling(max(UK$long))
min.lon <- floor(min(UK$long))
extent <- raster::extent(x = c(min.lon, max.lon, min.lat, max.lat))
#get variables data
bio<-raster::getData('worldclim',var='bio',res=5,lon=-2,lat=40)
bio <- bio[[c("bio1","bio12")]]
names(bio) <- c("Temp","Prec")
#crop to uk
bio<-raster::crop(bio,extent)
#convert to easting northing
vars <- raster::projectRaster(bio, crs="+init=epsg:27700")
#run the function
output <- MultiBNG(sp_list = sp_list, vars, out_flder = "Outputs/",dat_flder = "Inputs/", bkgd_flder = "BGmasks/", max_tries = 1, datafrom = "NBNatlas", covarRes = 100, models = "BioClim", prop_test_data = 0.25, bngCol = "OSGR", mult_prssr = FALSE, rndm_occ = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.