Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/FUNCTION_overlapCalc.R
This function calculates the monthly overlap and fishing effort index of each individual in gridded data
1 2 | overlapCalc(mon = c('01','02','03','04','05','06','07','08','09','10','11','12'),
sp, boatPath, shkPath, analyse = 'overlap', ncores = 1)
|
mon |
Character vector of months to calculate overlap, with double digits. Eg: January is '01'. Defaults to c('01','02','03','04','05','06','07','08','09','10','11','12') |
sp |
Character of unique species to analyse |
boatPath |
Path to boat files of monthly rasters |
shkPath |
Path to individual dit (density of tracking data) files |
analyse |
Analysis type: 'effort' or 'overlap'. Defaults to 'overlap' |
ncores |
Number of cores to use in parallel. Defaults to 1 (no parallel run). |
This function can be time-consuming and requires high memory capacity. We advice to use up to 75 percent of available cores and/or break data into chunks whenever possible.
Returns a list of data.frames, where each level is a different month within a species
Marisa Vedor, Ivo da Costa, Nuno Queiroz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | fld <- '~/r_scripts/2_fei/examples/'
# Shark raster path
shkPath <- list.files(fld,'.tif', recursive = TRUE, full.names = TRUE)
# Species names
spp <- basename(dirname(shkPath))
# Exclude other rasters
shkPath <- shkPath[!is.na(spp)]
spp <- spp[!is.na(spp)]
# Boat file path
boatFiles <- list.files(boatFld, '.tif', full.names = TRUE)
# Calculate species overlap or effort for each month
spOverLs <- overlapCalc(mon = c('01', '02'), sp = 'bk',
boatPath = boatFiles,
shkPath = shkPath[grepl(paste0('^',sp, '_'), basename(shkPath))],
analyse)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.