diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 1bd6552..8b6711c 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 2.1.1 -Date: 2022-11-22 10:49:33.969 UTC -SHA: 67c7b4227692e8479fe385b11fbe8cb4a59ca98d +Version: 2.1.2 +Date: 2023-03-30 10:19:09.372 UTC +SHA: 119640b3cb69afd00649a6f5c304c3c4ac5e882b diff --git a/DESCRIPTION b/DESCRIPTION index 31c8e82..f2c6ad9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,18 +1,18 @@ Package: dynamAedes -Version: 2.1.1 -Date: 2022-11-21 +Version: 2.1.2 +Date: 2023-03-23 Title: A Unified Mechanistic Model for the Population Dynamics of Invasive Aedes Mosquitoes Authors@R: c(person("Matteo", "Marcantonio", role = c("aut", "cre"), email = "marcantoniomatteo@gmail.com"),person("Daniele", "Da Re", role = c("aut"), email = "dare.daniele@gmail.com")) -Depends: R (>= 3.6.0), raster -Imports: drc, fields, foreach, insol, slam, doParallel, sp +Depends: R (>= 4.0.0) +Imports: doParallel, dplyr, drc, fields, foreach, geosphere, raster, slam, sp BugReports: https://github.com/mattmar/dynamAedes -Description: Generalised model for population dynamics of invasive Aedes mosquitoes. Rationale and model structure are described here: Da Re, ..., Marcantonio (2021) and Da Re, ..., Marcantonio (2022) . +Description: Generalised model for population dynamics of invasive Aedes mosquitoes. Rationale and model structure are described here: Da Re et al. (2021) and Da Re et al. (2022) . VignetteBuilder: knitr Encoding: UTF-8 Language: en-GB License: GPL(>=2) Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.1 -Suggests: parallel, rmarkdown, knitr, eesim, geosphere, ggplot2, gstat, rgeos, spatstat, rgdal, tidyverse +RoxygenNote: 7.2.3 +Suggests: terra, parallel, rmarkdown, knitr, eesim, ggplot2, gstat, spatstat, rgdal Config/testthat/edition: 3 URL: https://mattmar.github.io/dynamAedes/ diff --git a/NAMESPACE b/NAMESPACE index ce0b102..7ae9252 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,17 +9,12 @@ importFrom("stats", "dgamma", "dlnorm", "lm", "predict", "rbinom", "rmultinom", importFrom("fields", "rdist") importFrom("slam", "as.simple_sparse_array") importFrom("drc", "drm") -importFrom("insol", "JD", "daylength") +importFrom("geosphere", "daylength") importFrom("raster", "stack", "raster", "rasterFromXYZ") importFrom("sp", "gridded", "coordinates", "spTransform", "CRS", "SpatialPoints") - +importFrom("dplyr", "%>%", "bind_rows", "as_tibble", "mutate") ##################################### ## Export ## ##################################### -export(dynamAedes.m, .beta.fun, .DRC.beta, .beta.init) -export(.a.a_disp.f, .a.gono_rate.f, .a.ovi_rate.f, -.a.surv_rate.f, .i.emer_rate.f, .e.surv_rate.f, -.i.surv_rate.f, .e.hatch_rate.f, .e.dia_rate.f, -.d.surv_rate.f, .i.ddmort_rate.f, psi, psi_sp, -icci, adci, adci_sp, dici, -.returndis, .euc, .meuc) \ No newline at end of file +export(dynamAedes.m) +export(psi, psi_sp, icci, adci, adci_sp, dici) \ No newline at end of file diff --git a/NEWS.md b/NEWS.md index fc801fe..20ba753 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# dynamAedes 2.1.2 +* Transitioning from 'rgdal' and 'sp' to 'terra' +* Transitioning from 'insol' to 'geosphere' +* Removing block-loading of 'tidyverse' (speeding up loading?) +* Helper functions not anymore exported + # dynamAedes 2.1.1 * Adding rgdal in the description diff --git a/R/beta_functions.R b/R/beta_functions.R deleted file mode 100644 index 821b2cf..0000000 --- a/R/beta_functions.R +++ /dev/null @@ -1,55 +0,0 @@ -# Functions taken from https://github.com/OnofriAndreaPG/aomisc -.beta.fun <- function(X, b, d, Xb, Xo, Xc){ - .expr1 <- (X - Xb)/(Xo - Xb) - .expr2 <- (Xc - X)/(Xc - Xo) - .expr3 <- (Xc - Xo)/(Xo - Xb) - #ifelse(temp > tb & temp < tc, (.expr2*.expr1^(1/.expr3))^a, 0) - ifelse(X > Xb & X < Xc, d * (.expr1*.expr2^.expr3)^b, 0) -} - -.DRC.beta <- function(){ - - fct <- function(x, parm) { - # function code here - .beta.fun(x, parm[,1], parm[,2], parm[,3], parm[,4], parm[,5]) - } - ssfct <- function(data){ - # Self-starting code here - x <- data[, 1] - y <- data[, 2] - - d <- max(y) - Xo <- x[which.max(y)] - firstidx <- min( which(y !=0) ) - Xb <- ifelse(firstidx == 1, x[1], (x[firstidx] + x[(firstidx - 1)])/2) - secidx <- max( which(y !=0) ) - Xc <- ifelse(secidx == length(y), x[length(x)], (x[secidx] + x[(secidx + 1)])/2) - c(1, d, Xb, Xo, Xc) - - } - names <- c("b", "d", "Xb", "Xo", "Xc") - text <- "Beta function" - - ## Returning the function with self starter and names - returnList <- list(fct = fct, ssfct = ssfct, names = names, text = text) - class(returnList) <- "drcMean" - invisible(returnList) -} - -.beta.init <- function(mCall, LHS, data) { - xy <- sortedXyData(mCall[["X"]], LHS, data) - x <- xy[, "x"]; y <- xy[, "y"] - - #Self starting code ############## - d <- max(y) - Xo <- x[which.max(y)] - firstidx <- min( which(y !=0) ) - Xb <- ifelse(firstidx == 1, x[1], (x[firstidx] + x[(firstidx - 1)])/2) - secidx <- max( which(y !=0) ) - Xc <- ifelse(secidx == length(y), x[length(x)], (x[secidx] + x[(secidx + 1)])/2) - start <- c(1, d, Xb, Xo, Xc) - names(start) <- mCall[c("b", "d", "Xb", "Xo", "Xc")] - start -} - -NLS.beta <- selfStart(.beta.fun, .beta.init, parameters=c("b", "d", "Xb", "Xo", "Xc")) diff --git a/R/dici.R b/R/dici.R index 4bc7d05..aeae01b 100644 --- a/R/dici.R +++ b/R/dici.R @@ -44,27 +44,4 @@ dici <- function(input_sim=NULL, coords=NULL, eval_date=NULL, breaks=c(0.25,0.5, return(stack(outs)) } } -} - -# Ad-hoc functions -.returndis <- function(distl=NA, days=NA, breaks=breaks) { - out <- do.call(rbind.data.frame, - lapply(days, function(x) { - round(quantile(unlist(sapply(1:length(distl), - function(y) {mean(if(x<=length(distl[[y]])) as.integer(distl[[y]][[x]]) else NA, na.rm=T)})), probs=breaks, na.rm=T),1) - })) - names(out) <- breaks - return(out) -} - -.euc <- function(xs, ys) { sqrt((xs[1]-xs[2])^2 + (ys[1]-ys[2])^2) } -.meuc <- function(c1, c2, coords) { - c3 <- coords[unlist(c1[,1])[1],] - outd <- list(NA) - for ( rw in 1:length(c2) ) { - outd[[rw]] <- sapply(unlist(c2[rw]), function(x) { - .euc(c(as.numeric(c3[1]), as.numeric(coords[x,1])), c(as.numeric(c3[2]), as.numeric(coords[x,2]))) - }) - } - return(outd) -} +} \ No newline at end of file diff --git a/R/dynamAedes.m.R b/R/dynamAedes.m.R index 64541a3..330b443 100644 --- a/R/dynamAedes.m.R +++ b/R/dynamAedes.m.R @@ -44,18 +44,18 @@ dynamAedes.m <- function(species="aegypti", intro.eggs=0, intro.deggs=0, intro.a ### Initial checks #Species if( !species%in%c("aegypti","albopictus","koreicus","japonicus") ) { - stop("Species not supported, exiting..." ) + stop("Mosquito species not supported, exiting..." ) } #Dayspan if( is.na(endd) ) { if( nchar(strsplit(as.character(startd),"-")[[1]][1])<4 ) { - stop("Dates in the wrong format: change them to %Y-%m-%d") + stop("Dates in the wrong format: change them to '%Y-%m-%d'.") } dayspan <- as.integer(ncol(temps.matrix)-1) } else { if( nchar(strsplit(as.character(startd),"-")[[1]][1])<4|nchar(strsplit(as.character(endd),"-")[[1]][1])<4 ) { - stop("Dates in the wrong format: change them to %Y-%m-%d") + stop("Dates in the wrong format: change them to '%Y-%m-%d'.") } dayspan <- as.integer(as.Date(endd)-as.Date(startd)) } @@ -68,7 +68,6 @@ dynamAedes.m <- function(species="aegypti", intro.eggs=0, intro.deggs=0, intro.a if( is.na(coords.proj4) ) { stop("No proj4 string for input coordinates. Please set 'coords.proj4' option.") } else { - message("inside") cells.coords.photo <- as.data.frame(coordinates(spTransform(SpatialPoints(cells.coords, proj4string=CRS(coords.proj4)), CRSobj=CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")))) } } @@ -95,12 +94,13 @@ dynamAedes.m <- function(species="aegypti", intro.eggs=0, intro.deggs=0, intro.a } else (stop("avgpdisp not supported yet...")) ## Derive daylength for laying of diapausing eggs in albopictus/koreicus/japonicus if( species!="aegypti" ){ - jd <- JD(seq(as.POSIXct(startd), as.POSIXct(as.Date(startd)+dayspan), by='day')) + doy <- as.numeric(format(seq(as.POSIXct(startd), as.POSIXct(as.Date(startd)+dayspan), by='day'), "%j")) if( scale=="rg" ) { - photo.matrix <- lapply(jd, function(x){insol::daylength(long = cells.coords.photo[,1], lat=cells.coords.photo[,2], jd=x, 1)[,3]}) + photo.matrix <- lapply(doy, function(x){daylength(lat=cells.coords.photo[,2], doy=x)}) + photo.matrix <- do.call(cbind,photo.matrix) } else if( !is.na(lat)&!is.na(long) ) { - dl <- daylength(lat,long,jd,1)[,3] + dl <- daylength(lat,doy) photo.matrix <- matrix(dl, nrow=1) } else (stop("Something's wrong with scale or lat and long")) } else{ diff --git a/R/internal-helpers.R b/R/internal-helpers.R new file mode 100644 index 0000000..ca1de63 --- /dev/null +++ b/R/internal-helpers.R @@ -0,0 +1,398 @@ +#' Function 1 to start Beta functions: Functions taken from https://github.com/OnofriAndreaPG/aomisc +#' @description Function 1 to start Beta functions +#' @keywords internal +#' @return No return value, called for side effects in .DRC.beta +.beta.fun <- function(X, b, d, Xb, Xo, Xc){ + .expr1 <- (X - Xb)/(Xo - Xb) + .expr2 <- (Xc - X)/(Xc - Xo) + .expr3 <- (Xc - Xo)/(Xo - Xb) + ifelse(X > Xb & X < Xc, d * (.expr1*.expr2^.expr3)^b, 0) +} + +#' Function 2 to start Beta functions: Functions taken from https://github.com/OnofriAndreaPG/aomisc +#' @description Function 1 to start Beta functions +#' @keywords internal +#' @return No return value, called for side effects in drm +.DRC.beta <- function(){ + fct <- function(x, parm) { +# function code here +.beta.fun(x, parm[,1], parm[,2], parm[,3], parm[,4], parm[,5]) +} +ssfct <- function(data){ +# Self-starting code here +x <- data[, 1] +y <- data[, 2] + +d <- max(y) +Xo <- x[which.max(y)] +firstidx <- min( which(y !=0) ) +Xb <- ifelse(firstidx == 1, x[1], (x[firstidx] + x[(firstidx - 1)])/2) +secidx <- max( which(y !=0) ) +Xc <- ifelse(secidx == length(y), x[length(x)], (x[secidx] + x[(secidx + 1)])/2) +c(1, d, Xb, Xo, Xc) + +} +names <- c("b", "d", "Xb", "Xo", "Xc") +text <- "Beta function" + +## Returning the function with self starter and names +returnList <- list(fct = fct, ssfct = ssfct, names = names, text = text) +class(returnList) <- "drcMean" +invisible(returnList) +} + +#' Function 3 to start Beta functions: Functions taken from https://github.com/OnofriAndreaPG/aomisc +#' @description Function 1 to start Beta functions +#' @keywords internal +#' @return No return value, called for Beta function initiation in drm +.beta.init <- function(mCall, LHS, data) { + xy <- sortedXyData(mCall[["X"]], LHS, data) + x <- xy[, "x"]; y <- xy[, "y"] + +#Self starting code ############## +d <- max(y) +Xo <- x[which.max(y)] +firstidx <- min( which(y !=0) ) +Xb <- ifelse(firstidx == 1, x[1], (x[firstidx] + x[(firstidx - 1)])/2) +secidx <- max( which(y !=0) ) +Xc <- ifelse(secidx == length(y), x[length(x)], (x[secidx] + x[(secidx + 1)])/2) +start <- c(1, d, Xb, Xo, Xc) +names(start) <- mCall[c("b", "d", "Xb", "Xo", "Xc")] +start +} + +#NLS.beta <- selfStart(.beta.fun, .beta.init, parameters=c("b", "d", "Xb", "Xo", "Xc")) + +#' Daily rate of gonotrophic cycle +#' @description Daily rate of gonotrophic cycle, i.e., daily rate of adult females completing the cycle from bloodmeal to the first day of oviposition +#' @keywords internal +#' @return vector of rates. +.a.gono_rate.f <- function(temp.new, sp) { + if(sp=="aegypti") { + gono_d <- 1/c(30,15,7,5,4,4,5,5,6,7,35,100) + temp_d <- c(15,17,20,22,26,28,31,32,33,33,40, 45) + model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) + a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="albopictus") { + gono_d <- 1/c(8.1, 4.5, 3.5, 4, 4.4, 100) + temp_d <- c(20, 25, 30, 32.5, 35, 45) + model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) + a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="koreicus") { + gono_d <- 1/c(14.75, 11.5, 9.21, 10, 10.81, 100) + temp_d <- c( 18, 23, 23, 25, 28, 33) + model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) + a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) + } else if(sp=="japonicus") { + gono_d <- 1/c(14.75, 11.5, 9.21, 10, 10.81, 100) + temp_d <- c( 18, 23, 23, 25, 28, 33) + model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) + a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) + } else(stop("Species not supported.")) + return(a.gono.pred) + } + +#' Oviposition rate +#' @description Oviposition rate, i.e., number of eggs laid per female/day at different temperature +#' @keywords internal +#' @return vector of rates. +.a.ovi_rate.f <- function(temp.new, sp) { + if(sp=="aegypti") { + ovi_n <- c( 0, 2.5, 3.37, 4.6, 6.98, 7.6, 9.58, 7.28,11.22,7.27,0) * 10 + temp_n <- c(0, 10,20.05,21.79,25.64,27.64,31.33,31.65,32.55,33.41,34) + model=lm(ovi_n~poly(temp_n,3)) + a.ovi.pred <- predict(model, newdata = data.frame(temp_n=temp.new), response=TRUE) + a.ovi.pred <- ifelse(a.ovi.pred<0, 0, a.ovi.pred) + a.ovi.pred[which(temp.new<4|temp.new>45)] <- 0 + }else if(sp=="albopictus") { + ovi_n <- c(0, 50.8, 65.3, 74.2, 48.7, 0) + temp_n <- c(5, 20, 25, 30, 35, 45) + model <- drm(ovi_n ~ temp_n, fct = .DRC.beta()) + a.ovi.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="koreicus") { + ovi_n <- c(0, 5, 20, 25, 30, 38, 40, 40, 38, 20, 10, 10, 0) + temp_n <-c(8, 10,12, 15,17, 20, 23, 25, 27, 30, 33, 35,37) + model <- drm(ovi_n ~ temp_n, fct = .DRC.beta()) + a.ovi.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="japonicus") { + ovi_n <- c(0, 108.2, 111.6, 106.8, 112.2, 97.1, 99.1, 94.5, 80.6, 82.1, 71.6, 67.4, 68.4, 55.0, 47.4,0) + temp_n <-c(5, 10, 12, 14, 15, 17, 19, 20, 23, 25, 26, 27, 28, 29, 31, 40) + model <- drm(ovi_n ~ temp_n, fct = .DRC.beta()) + a.ovi.pred <- predict(model,data.frame(temp.v=temp.new)) + }else(stop("Species not supported.")) + return( a.ovi.pred ) + } + +#' Adult female daily mortality rate +#' @description Adult female daily mortality rate at different temperatures +#' @keywords internal +#' @return vector of rates. +.a.surv_rate.f <- function(temp.new, sp) { + if(sp=="aegypti") { + surv_d <- c(3,13.18,10.91,27.71,30.62,23.72,26.90,32.87,36.91,22.77,29.26,22.53,10.07,5) + temp_d <- c(5,10.54,10.76,15.30,16.52,20.05,21.79,25.64,27.64,31.33,31.65,32.55,33.41,36) + model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) + a.surv.rate <- predict(model,data.frame(temp.v=temp.new)) + a.surv.rate <- 1-1/ifelse(a.surv.rate<1,1,a.surv.rate) + }else if(sp=="albopictus") { + a=0.677; b=20.9; c=-13.2 + a.surv.rate <- sapply(temp.new, function(x) { + if( x>0 ){ + a*exp(-0.5*((x-b)/c)^6)*(x^0.1) + } else { + a*exp(-0.5*((x-b)/c)^6) + } + }) + }else if(sp=="koreicus" | sp=="japonicus") { + surv_d <- 1-(1/c(1,2,52.33,46.77,66.33,5.87, 3, 1)) + temp_d <- c(0,5, 18,23,28,33, 35, 38) + model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) + a.surv.rate <- predict(model,data.frame(temp.v=temp.new)) +#koreicus adults longevity (Tab. 3, Marini et al 2019) +temp_dev=c(1,5,18,23,28,33) #I've added arbitrary adult longevity at 5°C equal to 30 days, and adult longevity at 1°C equal to 1 days +obs_dev=c(1, 30, 52.33, 46.77, 66.33, 5.87) +m=lm(obs_dev~poly(temp_dev,2)) +dev_time=predict(m, newdata = data.frame(temp_dev=temp.new), response=TRUE) +dev_time=ifelse(dev_time<=1, 1, dev_time) +#correction with development time to get daily survival rate +a.surv.rate= round(a.surv.rate^(1/dev_time),3) +}else if(sp=="japonicus") { + surv_d <- c(0, 99.0, 97.2, 91.8, 98.8, 91.0, 81.6, 93.6, 68.9, 71.4, 71.4, 60.7, 68.9, 34.0, 40.8,0 )/100 + temp_n <- c(-5, 10, 12, 14, 15, 17, 19, 20, 23, 25, 26, 27, 28, 29, 31, 40) + model <- drm(surv_d ~ temp_n, fct = .DRC.beta()) + a.surv.rate <- predict(model,data.frame(temp.v=temp.new)) +} +else(stop("Species not supported.")) +return( a.surv.rate ) +} + +#' Log-Normal probability density of short active dispersal +#' @description Log-Normal probability density of short active dispersal from Marcantonio et al. 2019; Marini et al. 2019. 0 to 600 m with resolution of 10 m. +#' @keywords internal +#' @return vector of rates. +.a.a_disp.f <- function(sp, max.a.disp, disp.bins) { + if(sp=="aegypti"){ + dispk <- dlnorm(seq(0,max.a.disp,disp.bins), meanlog=4.95, sdlog=0.66) + }else if(sp=="albopictus") { + dispk <- dlnorm(seq(0,max.a.disp,disp.bins), meanlog=4.54, sdlog=0.58) + }else if(sp=="koreicus") { +dispk <- dlnorm(seq(0,max.a.disp,disp.bins), meanlog=4.54, sdlog=0.58) #check paper svizzera +}else(stop("Species not supported.")) +return( dispk ) +} + +#' Immature daily emergence rate +#' @description Immature daily emergence rate at different temperature +#' @keywords internal +#' @return vector of rates. +.i.emer_rate.f <- function(temp.new, sp) { + if(sp=="aegypti") { + eme_d <- 1/(c(500,61.7,39.7,84.4,10.0,9.2,8.4,6.3,7.4,5.1,8.1,6.3,50)*0.2980392) + temp_d <- c(12,14.74,14.84,14.92,26.56,26.84,26.85,30.83,31.61,34.95,36.47,36.55,42) + model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) + i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp== "albopictus") { + eme_d <- 1/c(100,8.7,4.1,2.7,1.9,1.7,5) + temp_d <- c(5,15,20,25,30,35,38) + model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) + i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="koreicus") { + eme_d <- 1/c(35, 10.31, 4.19, 3.43, 3.00, 2.07, 1.82, 5, 25) + temp_d <- c(8, 13, 18, 23, 23, 28, 33, 35, 40) + model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) + i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="japonicus") { +# This refers to the total % of emergency, it must be corrected with the durations to get a daily rate +eme_d= c( 0.07, 0.1, 0.15, 0.17, 0.21, 0.32, 0.29, 0.35, 0.43, 0.43, 0.44, 0.45, 0.5, 0.67, 0.4,0.2, 0) +temp_d <- c(10, 12, 14, 15, 17, 19, 20, 23, 25, 26, 27, 28, 29, 31, 33, 35,40) +model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) +i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) +}else(stop("Species not supported.")) +return( i.emer.pred ) +} + +#' Immature daily survival rat +#' @description Immature daily survival rate at different temperature +#' @keywords internal +#' @return vector of rates. +.i.surv_rate.f <- function(temp.new, sp) { + if(sp=="aegypti") { + surv_d <- 1-(1/ c(1,6.2,10.3,12,2,4.5,2.1,5.7,4.8,47.9,42.7,55.3,27.2,48.5,30.2,14.7,15.8,15.7,9.5,16.8,8.6,14.2,1)) + temp_d <- c(2,10,10,10,10,10.38,10.45,10.45,10,14.74,14.84,14.92,18.86,19.04,19.18,26.56,26.84,26.85,30.83,31.61,34.95,36.47,39) + model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) + i.surv.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="albopictus") { + a=0.977 + b=20.8 + c=-12.6 + i.surv.pred <- a*exp(-0.5*((temp.new-b)/c)^6) + }else if(sp=="koreicus") { +#surv_d <- c(0, 50, 80, 97.8, 93.5, 95.6, 92.8, 84.7, 0)/100 # patch +#temp_d <- c(-5, 0, 8, 13, 18, 23, 28, 33, 37) #patch +surv_d <- c(0, 80, 97.8, 93.5, 95.6, 92.8, 84.7, 0)/100 +temp_d <- c(-5, 8, 13, 18, 23, 28, 33, 37) +model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) +i.surv.pred <- predict(model,data.frame(temp.v=temp.new)) +#koreicus adults longevity (Tab. 2, Marini et al 2019) +temp_dev=c(13, 18,23,28,33) +obs_dev=c(9.47,5.71,3.66,2.72,2.78) +m=lm(obs_dev~poly(temp_dev,2)) +dev_time=predict(m, newdata = data.frame(temp_dev=temp.new), response=TRUE) +i.surv.pred= round(i.surv.pred^(1/dev_time),3) +} else if(sp=="japonicus") { + surv_d <- c(0, 0, 92.5, 78.77, 90.59, 92.19, 90.32, 83.86, 94.08, 91.35, 75.5, 90.63, 96.95, 90.83, 53, 38.65, 0)/100 + temp_d <- c(0, 5, 10, 12, 14, 15, 17, 19, 20, 21, 23, 25, 26, 27, 29, 31,45) + model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) + i.surv.pred <- predict(model,data.frame(temp.v=temp.new)) + }else(stop("Species not supported.")) + return( i.surv.pred ) +} + +#' Immature Density-dependent mortality rate +#' @description Immature Density-dependent mortality +#' @keywords internal +#' @return vector of rates. +.i.ddmort_rate.f <- function(dens.new) { + i.dens.v = c(87.72,561.40,1175.44,1280.70,1491.23,1675.44,1982.46,2350.88,2850.88,3122.81,3236.84,3307.02,3359.65,3456.14,3570.18,3640.35,3666.67,3771.93,3877.19,3982.46) + i.dsurv_prop.v = c(0.95,0.43,0.57,0.42,0.49,0.35,0.25,0.17,0.13,0.05,0.2,0.27,0.11, 0.11,0.06,0.04,0.09,0.13,0.07, 0.14) + i.dsur_dur.v = c(7.46,9.96,28.09,17.46,29.12,38.31,42.22,40.95,44.31,42.34,20.91,17.43, + 37.12,29.73,40,43,22,51,50,31) +# Transform survival proportion to multidays mortality rate +i.dmort_rate.v = -log(i.dsurv_prop.v) +# Transform multiday mortality rate to daily mortality rate +i.dmort_rate.v = i.dmort_rate.v/i.dsur_dur.v +# Fit a model for daily mortality rate using just density as a predictor +i.dmort.lm <- lm(log(i.dmort_rate.v) ~ i.dens.v) +i.dmort.pred <- predict(i.dmort.lm, dens.new) +return( i.dmort.pred ) +} + +#' Egg hatching rate +#' @description Egg hatching rate: this rate decides embryonated eggs which hatch or stay +#' @keywords internal +#' @return vector of rates. +.e.hatch_rate.f <- function(temp.new, sp) { + if(sp=="aegypti") { + hatc_d <- c(0, 0.025,1,0.98, 0.99, 0.73, 0.30, 0.016) + temp_d <- c(7, 12, 19, 23, 24.5, 26.5, 29.5, 40) + model <- lm(hatc_d ~ poly(temp_d,3)) + e.hatch.pred <- predict(model,data.frame(temp_d=temp.new), response=TRUE) + e.hatch.pred <- ifelse(e.hatch.pred<0, 0, e.hatch.pred) + e.hatch.pred[which(temp.new>41)] <- 0 + }else if(sp=="albopictus") { + hatc_d <-c(2,4.4,4.0,50,100,60,51.4,10.0,0)/100 + temp_d <-seq(0,40,by=5) + model <- lm(hatc_d ~ poly(temp_d,4)) + e.hatch.pred <- predict(model,data.frame(temp_d=temp.new), response=TRUE) + e.hatch.pred <- ifelse(e.hatch.pred<0, 0, e.hatch.pred) + e.hatch.pred[which(temp.new<4|temp.new>40)] <- 0 + }else if(sp=="koreicus") { + hatc_d <- (c(0, 7.25, 60.50, 43.75, 31.00, 27.25,10,0)/100)/0.636 + temp_d <- c(0,8,13,23,28,33,36, 36.5) + model <- lm(hatc_d ~ poly(temp_d,3)) + e.hatch.pred <- predict(model,data.frame(temp_d=temp.new), response=TRUE) + e.hatch.pred <- ifelse(e.hatch.pred<0, 0, e.hatch.pred) + e.hatch.pred[which(temp.new<4)] <- 0 + }else if(sp=="japonicus") { + hatc_d <- c(0.4075, 0.8275, 0.9175, 0.89,0) + temp_d <- c(0,10,20,30,35) + model <- drm(hatc_d ~ temp_d, fct = .DRC.beta()) + e.hatch.pred <- predict(model,data.frame(temp.v=temp.new)) + }else(stop("Species not supported.")) + return( e.hatch.pred ) + } + +#' Egg daily survival rate +#' @description Egg daily survival rate at different temperature +#' @keywords internal +#' @return vector of rates. +.e.surv_rate.f <- function(temp.new, sp) { + if(sp=="aegypti") { + surv_r <- c(0,0,0,0,0,0,0.4,0.6,0.78,0.81,0.88,0.95,0.96,0.91,0.93,0.83,0.90,0.48,0) + temp_r <- c(-17,-15,-12,-10,-7,-5,-2,0,15.6,16,21,22,25.0,26.7,28.0,31.0,32.0,35.0,40.0) + model <- drm(surv_r ~ temp_r, fct = .DRC.beta()) + e.surv.pred <- predict(model,data.frame(temp.v=temp.new)) + }else if(sp=="albopictus" ) { + a= 0.955 + b= 16 + c= -17 + e.surv.pred=a*exp(-0.5*((temp.new-b)/c)^6) + }else if(sp=="koreicus") { + ed_surv_bl=1 + a= 0.98 + b= 15.8 + c= -15.8 + e.surv.pred=ed_surv_bl*a*exp(-0.5*((temp.new-b)/c)^6) + }else if(sp=="japonicus") { + surv_r <- c(0, 0.44, 0.79, 0.9017, 0.8817, 0) + temp_r <-c(-15,0,10,20,30,35) + model <- drm(surv_r ~ temp_r, fct = .DRC.beta()) + e.surv.pred <- predict(model,data.frame(temp.v=temp.new)) + }else(stop("Species not supported.")) + return( e.surv.pred ) + } + +#' Diapause eggs daily survival rate +#' @description Diapause eggs daily survival rate at different temperature +#' @keywords internal +#' @return vector of rates. +.d.surv_rate.f <- function(temp.new, sp){ + if(sp=="albopictus") { + ed_surv_bl=1 + a=0.955 + b=11.68 + c=-15.67 + d.surv.pred=ed_surv_bl*a*exp(-0.5*((temp.new-b)/c)^6) + }else if(sp=="koreicus" | sp=="japonicus") { + d.surv.pred=rep(0.999,length(temp.new)) + }else(stop("Species not supported.")) + return( d.surv.pred ) + } + +#' Allocation of diapause eggs +#' @description Allocation of diapause eggs dependent on photoperiod +#' @keywords internal +#' @return vector of rates. +.e.dia_rate.f <- function(photo.new, sp) { + if(sp=="albopictus") { + e.diap.pred <-1/(1+exp(3.04*(photo.new-12.62))) + }else if(sp=="koreicus" | sp=="japonicus") { + e.diap.pred <-1/(1+exp(3.04*(photo.new-12.97))) + } else(stop("Species not supported.")) + return(e.diap.pred) + } + +#' Distance moved by mosquito populations +#' @description Return quantiles of distance moved by mosquito populations +#' @keywords internal +#' @return vector of quantiles of distances. +.returndis <- function(distl=NA, days=NA, breaks=breaks) { + out <- do.call(rbind.data.frame, + lapply(days, function(x) { + round(quantile(unlist(sapply(1:length(distl), + function(y) {mean(if(x<=length(distl[[y]])) as.integer(distl[[y]][[x]]) else NA, na.rm=T)})), probs=breaks, na.rm=T),1) + })) + names(out) <- breaks + return(out) +} + +#' Euclidean distance +#' @description Return Euclidean distance +#' @keywords internal +#' @return float. An euclidean distance. +.euc <- function(xs, ys) { sqrt((xs[1]-xs[2])^2 + (ys[1]-ys[2])^2) } + +#' Euclidean distance from a pair of coordinates +#' @description Returns Euclidean distance from a pair of coordinates +#' @keywords internal +#' @return float. Vector of Euclidean distances. +.meuc <- function(c1, c2, coords) { + c3 <- coords[unlist(c1[,1])[1],] + outd <- list(NA) + for ( rw in 1:length(c2) ) { + outd[[rw]] <- sapply(unlist(c2[rw]), function(x) { + .euc(c(as.numeric(c3[1]), as.numeric(coords[x,1])), c(as.numeric(c3[2]), as.numeric(coords[x,2]))) + }) + } + return(outd) +} diff --git a/R/sp.R b/R/sp.R deleted file mode 100644 index e2a9b4e..0000000 --- a/R/sp.R +++ /dev/null @@ -1,324 +0,0 @@ - # library(aomisc) - - #1 ---- beta ---- - # Functions taken from https://github.com/OnofriAndreaPG/aomisc - .beta.fun <- function(X, b, d, Xb, Xo, Xc){ - .expr1 <- (X - Xb)/(Xo - Xb) - .expr2 <- (Xc - X)/(Xc - Xo) - .expr3 <- (Xc - Xo)/(Xo - Xb) - ifelse(X > Xb & X < Xc, d * (.expr1*.expr2^.expr3)^b, 0) - } - - .DRC.beta <- function(){ - fct <- function(x, parm) { - # function code here - .beta.fun(x, parm[,1], parm[,2], parm[,3], parm[,4], parm[,5]) - } - ssfct <- function(data){ - # Self-starting code here - x <- data[, 1] - y <- data[, 2] - - d <- max(y) - Xo <- x[which.max(y)] - firstidx <- min( which(y !=0) ) - Xb <- ifelse(firstidx == 1, x[1], (x[firstidx] + x[(firstidx - 1)])/2) - secidx <- max( which(y !=0) ) - Xc <- ifelse(secidx == length(y), x[length(x)], (x[secidx] + x[(secidx + 1)])/2) - c(1, d, Xb, Xo, Xc) - - } - names <- c("b", "d", "Xb", "Xo", "Xc") - text <- "Beta function" - - ## Returning the function with self starter and names - returnList <- list(fct = fct, ssfct = ssfct, names = names, text = text) - class(returnList) <- "drcMean" - invisible(returnList) - } - - .beta.init <- function(mCall, LHS, data) { - xy <- sortedXyData(mCall[["X"]], LHS, data) - x <- xy[, "x"]; y <- xy[, "y"] - - #Self starting code ############## - d <- max(y) - Xo <- x[which.max(y)] - firstidx <- min( which(y !=0) ) - Xb <- ifelse(firstidx == 1, x[1], (x[firstidx] + x[(firstidx - 1)])/2) - secidx <- max( which(y !=0) ) - Xc <- ifelse(secidx == length(y), x[length(x)], (x[secidx] + x[(secidx + 1)])/2) - start <- c(1, d, Xb, Xo, Xc) - names(start) <- mCall[c("b", "d", "Xb", "Xo", "Xc")] - start - } - - NLS.beta <- selfStart(.beta.fun, .beta.init, parameters=c("b", "d", "Xb", "Xo", "Xc")) - - #2 --- functions ---- - - ## Daily rate of gonotrophic cycle, i.e., daily rate of adult females completing the cycle from bloodmeal to the first day of oviposition. ## - .a.gono_rate.f <- function(temp.new, sp) { - if(sp=="aegypti") { - gono_d <- 1/c(30,15,7,5,4,4,5,5,6,7,35,100) - temp_d <- c(15,17,20,22,26,28,31,32,33,33,40, 45) - model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) - a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="albopictus") { - gono_d <- 1/c(8.1, 4.5, 3.5, 4, 4.4, 100) - temp_d <- c(20, 25, 30, 32.5, 35, 45) - model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) - a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="koreicus") { - gono_d <- 1/c(14.75, 11.5, 9.21, 10, 10.81, 100) - temp_d <- c( 18, 23, 23, 25, 28, 33) - model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) - a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) - } else if(sp=="japonicus") { - gono_d <- 1/c(14.75, 11.5, 9.21, 10, 10.81, 100) - temp_d <- c( 18, 23, 23, 25, 28, 33) - model <- drm(gono_d ~ temp_d, fct = .DRC.beta()) - a.gono.pred <- predict(model,data.frame(temp.v=temp.new)) - } else(stop("Species not supported.")) - return(a.gono.pred) - } - - ## Oviposition rate, i.e., number of eggs laid per female/day at different temperature ## - .a.ovi_rate.f <- function(temp.new, sp) { - if(sp=="aegypti") { - ovi_n <- c( 0, 2.5, 3.37, 4.6, 6.98, 7.6, 9.58, 7.28,11.22,7.27,0) * 10 - temp_n <- c(0, 10,20.05,21.79,25.64,27.64,31.33,31.65,32.55,33.41,34) - model=lm(ovi_n~poly(temp_n,3)) - a.ovi.pred <- predict(model, newdata = data.frame(temp_n=temp.new), response=TRUE) - a.ovi.pred <- ifelse(a.ovi.pred<0, 0, a.ovi.pred) - a.ovi.pred[which(temp.new<4|temp.new>45)] <- 0 - }else if(sp=="albopictus") { - ovi_n <- c(0, 50.8, 65.3, 74.2, 48.7, 0) - temp_n <- c(5, 20, 25, 30, 35, 45) - model <- drm(ovi_n ~ temp_n, fct = .DRC.beta()) - a.ovi.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="koreicus") { - ovi_n <- c(0, 5, 20, 25, 30, 38, 40, 40, 38, 20, 10, 10, 0) - temp_n <-c(8, 10,12, 15,17, 20, 23, 25, 27, 30, 33, 35,37) - model <- drm(ovi_n ~ temp_n, fct = .DRC.beta()) - a.ovi.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="japonicus") { - ovi_n <- c(0, 108.2, 111.6, 106.8, 112.2, 97.1, 99.1, 94.5, 80.6, 82.1, 71.6, 67.4, 68.4, 55.0, 47.4,0) - temp_n <-c(5, 10, 12, 14, 15, 17, 19, 20, 23, 25, 26, 27, 28, 29, 31, 40) - model <- drm(ovi_n ~ temp_n, fct = .DRC.beta()) - a.ovi.pred <- predict(model,data.frame(temp.v=temp.new)) - }else(stop("Species not supported.")) - return( a.ovi.pred ) - } - - ## Adult female daily mortality rate at different temperatures ## - .a.surv_rate.f <- function(temp.new, sp) { - if(sp=="aegypti") { - surv_d <- c(3,13.18,10.91,27.71,30.62,23.72,26.90,32.87,36.91,22.77,29.26,22.53,10.07,5) - temp_d <- c(5,10.54,10.76,15.30,16.52,20.05,21.79,25.64,27.64,31.33,31.65,32.55,33.41,36) - model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) - a.surv.rate <- predict(model,data.frame(temp.v=temp.new)) - a.surv.rate <- 1-1/ifelse(a.surv.rate<1,1,a.surv.rate) - }else if(sp=="albopictus") { - a=0.677; b=20.9; c=-13.2 - a.surv.rate <- sapply(temp.new, function(x) { - if( x>0 ){ - a*exp(-0.5*((x-b)/c)^6)*(x^0.1) - } else { - a*exp(-0.5*((x-b)/c)^6) - } - }) - }else if(sp=="koreicus" | sp=="japonicus") { - surv_d <- 1-(1/c(1,2,52.33,46.77,66.33,5.87, 3, 1)) - temp_d <- c(0,5, 18,23,28,33, 35, 38) - model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) - a.surv.rate <- predict(model,data.frame(temp.v=temp.new)) - #koreicus adults longevity (Tab. 3, Marini et al 2019) - temp_dev=c(1,5,18,23,28,33) #I've added arbitrary adult longevity at 5°C equal to 30 days, and adult longevity at 1°C equal to 1 days - obs_dev=c(1, 30, 52.33, 46.77, 66.33, 5.87) - m=lm(obs_dev~poly(temp_dev,2)) - dev_time=predict(m, newdata = data.frame(temp_dev=temp.new), response=TRUE) - dev_time=ifelse(dev_time<=1, 1, dev_time) - #correction with development time to get daily survival rate - a.surv.rate= round(a.surv.rate^(1/dev_time),3) - }else if(sp=="japonicus") { - surv_d <- c(0, 99.0, 97.2, 91.8, 98.8, 91.0, 81.6, 93.6, 68.9, 71.4, 71.4, 60.7, 68.9, 34.0, 40.8,0 )/100 - temp_n <- c(-5, 10, 12, 14, 15, 17, 19, 20, 23, 25, 26, 27, 28, 29, 31, 40) - model <- drm(surv_d ~ temp_n, fct = .DRC.beta()) - a.surv.rate <- predict(model,data.frame(temp.v=temp.new)) - } - else(stop("Species not supported.")) - return( a.surv.rate ) -} - ## Log-Normal probability density of short active dispersal from Marcantonio et al. 2019; Marini et al. 2019. 0 to 600 m with resolution of 10 m. -.a.a_disp.f <- function(sp, max.a.disp, disp.bins) { - if(sp=="aegypti"){ - dispk <- dlnorm(seq(0,max.a.disp,disp.bins), meanlog=4.95, sdlog=0.66) - }else if(sp=="albopictus") { - dispk <- dlnorm(seq(0,max.a.disp,disp.bins), meanlog=4.54, sdlog=0.58) - }else if(sp=="koreicus") { - dispk <- dlnorm(seq(0,max.a.disp,disp.bins), meanlog=4.54, sdlog=0.58) #check paper svizzera - }else(stop("Species not supported.")) - return( dispk ) -} - - ## Immature daily emergence rate at different temperature ## -.i.emer_rate.f <- function(temp.new, sp) { - if(sp=="aegypti") { - eme_d <- 1/(c(500,61.7,39.7,84.4,10.0,9.2,8.4,6.3,7.4,5.1,8.1,6.3,50)*0.2980392) - temp_d <- c(12,14.74,14.84,14.92,26.56,26.84,26.85,30.83,31.61,34.95,36.47,36.55,42) - model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) - i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp== "albopictus") { - eme_d <- 1/c(100,8.7,4.1,2.7,1.9,1.7,5) - temp_d <- c(5,15,20,25,30,35,38) - model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) - i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="koreicus") { - eme_d <- 1/c(35, 10.31, 4.19, 3.43, 3.00, 2.07, 1.82, 5, 25) - temp_d <- c(8, 13, 18, 23, 23, 28, 33, 35, 40) - model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) - i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="japonicus") { - # This refers to the total % of emergency, it must be corrected with the durations to get a daily rate - eme_d= c( 0.07, 0.1, 0.15, 0.17, 0.21, 0.32, 0.29, 0.35, 0.43, 0.43, 0.44, 0.45, 0.5, 0.67, 0.4,0.2, 0) - temp_d <- c(10, 12, 14, 15, 17, 19, 20, 23, 25, 26, 27, 28, 29, 31, 33, 35,40) - model <- drm(eme_d ~ temp_d, fct = .DRC.beta()) - i.emer.pred <- predict(model,data.frame(temp.v=temp.new)) - }else(stop("Species not supported.")) - return( i.emer.pred ) -} - - ## Immature daily survival rate at different temperature ## -.i.surv_rate.f <- function(temp.new, sp) { - if(sp=="aegypti") { - surv_d <- 1-(1/ c(1,6.2,10.3,12,2,4.5,2.1,5.7,4.8,47.9,42.7,55.3,27.2,48.5,30.2,14.7,15.8,15.7,9.5,16.8,8.6,14.2,1)) - temp_d <- c(2,10,10,10,10,10.38,10.45,10.45,10,14.74,14.84,14.92,18.86,19.04,19.18,26.56,26.84,26.85,30.83,31.61,34.95,36.47,39) - model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) - i.surv.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="albopictus") { - a=0.977 - b=20.8 - c=-12.6 - i.surv.pred <- a*exp(-0.5*((temp.new-b)/c)^6) -}else if(sp=="koreicus") { - #surv_d <- c(0, 50, 80, 97.8, 93.5, 95.6, 92.8, 84.7, 0)/100 # patch - #temp_d <- c(-5, 0, 8, 13, 18, 23, 28, 33, 37) #patch - surv_d <- c(0, 80, 97.8, 93.5, 95.6, 92.8, 84.7, 0)/100 - temp_d <- c(-5, 8, 13, 18, 23, 28, 33, 37) - model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) - i.surv.pred <- predict(model,data.frame(temp.v=temp.new)) - #koreicus adults longevity (Tab. 2, Marini et al 2019) - temp_dev=c(13, 18,23,28,33) - obs_dev=c(9.47,5.71,3.66,2.72,2.78) - m=lm(obs_dev~poly(temp_dev,2)) - dev_time=predict(m, newdata = data.frame(temp_dev=temp.new), response=TRUE) - i.surv.pred= round(i.surv.pred^(1/dev_time),3) -} else if(sp=="japonicus") { - surv_d <- c(0, 0, 92.5, 78.77, 90.59, 92.19, 90.32, 83.86, 94.08, 91.35, 75.5, 90.63, 96.95, 90.83, 53, 38.65, 0)/100 - temp_d <- c(0, 5, 10, 12, 14, 15, 17, 19, 20, 21, 23, 25, 26, 27, 29, 31,45) - model <- drm(surv_d ~ temp_d, fct = .DRC.beta()) - i.surv.pred <- predict(model,data.frame(temp.v=temp.new)) -}else(stop("Species not supported.")) -return( i.surv.pred ) -} - - ## Immature Density-dependent mortality -.i.ddmort_rate.f <- function(dens.new) { - i.dens.v = c(87.72,561.40,1175.44,1280.70,1491.23,1675.44,1982.46,2350.88,2850.88,3122.81,3236.84,3307.02,3359.65,3456.14,3570.18,3640.35,3666.67,3771.93,3877.19,3982.46) - i.dsurv_prop.v = c(0.95,0.43,0.57,0.42,0.49,0.35,0.25,0.17,0.13,0.05,0.2,0.27,0.11, 0.11,0.06,0.04,0.09,0.13,0.07, 0.14) - i.dsur_dur.v = c(7.46,9.96,28.09,17.46,29.12,38.31,42.22,40.95,44.31,42.34,20.91,17.43, - 37.12,29.73,40,43,22,51,50,31) - # Transform survival proportion to multidays mortality rate - i.dmort_rate.v = -log(i.dsurv_prop.v) - # Transform multiday mortality rate to daily mortality rate - i.dmort_rate.v = i.dmort_rate.v/i.dsur_dur.v - # Fit a model for daily mortality rate using just density as a predictor - i.dmort.lm <- lm(log(i.dmort_rate.v) ~ i.dens.v) - i.dmort.pred <- predict(i.dmort.lm, dens.new) - return( i.dmort.pred ) -} - - ## Egg hatching rate - ## This rate decides embryonated eggs which hatch or stay -.e.hatch_rate.f <- function(temp.new, sp) { - if(sp=="aegypti") { - hatc_d <- c(0, 0.025,1,0.98, 0.99, 0.73, 0.30, 0.016) - temp_d <- c(7, 12, 19, 23, 24.5, 26.5, 29.5, 40) - model <- lm(hatc_d ~ poly(temp_d,3)) - e.hatch.pred <- predict(model,data.frame(temp_d=temp.new), response=TRUE) - e.hatch.pred <- ifelse(e.hatch.pred<0, 0, e.hatch.pred) - e.hatch.pred[which(temp.new>41)] <- 0 - }else if(sp=="albopictus") { - hatc_d <-c(2,4.4,4.0,50,100,60,51.4,10.0,0)/100 - temp_d <-seq(0,40,by=5) - model <- lm(hatc_d ~ poly(temp_d,4)) - e.hatch.pred <- predict(model,data.frame(temp_d=temp.new), response=TRUE) - e.hatch.pred <- ifelse(e.hatch.pred<0, 0, e.hatch.pred) - e.hatch.pred[which(temp.new<4|temp.new>40)] <- 0 - }else if(sp=="koreicus") { - hatc_d <- (c(0, 7.25, 60.50, 43.75, 31.00, 27.25,10,0)/100)/0.636 - temp_d <- c(0,8,13,23,28,33,36, 36.5) - model <- lm(hatc_d ~ poly(temp_d,3)) - e.hatch.pred <- predict(model,data.frame(temp_d=temp.new), response=TRUE) - e.hatch.pred <- ifelse(e.hatch.pred<0, 0, e.hatch.pred) - e.hatch.pred[which(temp.new<4)] <- 0 - }else if(sp=="japonicus") { - hatc_d <- c(0.4075, 0.8275, 0.9175, 0.89,0) - temp_d <- c(0,10,20,30,35) - model <- drm(hatc_d ~ temp_d, fct = .DRC.beta()) - e.hatch.pred <- predict(model,data.frame(temp.v=temp.new)) - }else(stop("Species not supported.")) - return( e.hatch.pred ) -} - - ## Egg daily survival rate at different temperature ## -.e.surv_rate.f <- function(temp.new, sp) { - if(sp=="aegypti") { - surv_r <- c(0,0,0,0,0,0,0.4,0.6,0.78,0.81,0.88,0.95,0.96,0.91,0.93,0.83,0.90,0.48,0) - temp_r <- c(-17,-15,-12,-10,-7,-5,-2,0,15.6,16,21,22,25.0,26.7,28.0,31.0,32.0,35.0,40.0) - model <- drm(surv_r ~ temp_r, fct = .DRC.beta()) - e.surv.pred <- predict(model,data.frame(temp.v=temp.new)) - }else if(sp=="albopictus" ) { - a= 0.955 - b= 16 - c= -17 - e.surv.pred=a*exp(-0.5*((temp.new-b)/c)^6) - }else if(sp=="koreicus") { - ed_surv_bl=1 - a= 0.98 - b= 15.8 - c= -15.8 - e.surv.pred=ed_surv_bl*a*exp(-0.5*((temp.new-b)/c)^6) - }else if(sp=="japonicus") { - surv_r <- c(0, 0.44, 0.79, 0.9017, 0.8817, 0) - temp_r <-c(-15,0,10,20,30,35) - model <- drm(surv_r ~ temp_r, fct = .DRC.beta()) - e.surv.pred <- predict(model,data.frame(temp.v=temp.new)) - }else(stop("Species not supported.")) - return( e.surv.pred ) -} - - ## Diapause eggs daily survival rate at different temperature ## -.d.surv_rate.f <- function(temp.new, sp){ - if(sp=="albopictus") { - ed_surv_bl=1 - a=0.955 - b=11.68 - c=-15.67 - d.surv.pred=ed_surv_bl*a*exp(-0.5*((temp.new-b)/c)^6) - }else if(sp=="koreicus" | sp=="japonicus") { - d.surv.pred=rep(0.999,length(temp.new)) - }else(stop("Species not supported.")) - return( d.surv.pred ) -} - - #Allocation of diapause eggs dependent on photoperiod -.e.dia_rate.f <- function(photo.new, sp) { - if(sp=="albopictus") { - e.diap.pred <-1/(1+exp(3.04*(photo.new-12.62))) - }else if(sp=="koreicus" | sp=="japonicus") { - e.diap.pred <-1/(1+exp(3.04*(photo.new-12.97))) - } else(stop("Species not supported.")) - return(e.diap.pred) -} \ No newline at end of file diff --git a/README.md b/README.md index f348507..7e1efc2 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,16 @@ status](https://www.r-pkg.org/badges/version/dynamAedes)](https://cran.r-project The model is driven by temperature, photoperiod and intra-specific larval competition and can be applied to three different "spatial scales": punctual, local and regional. These modes consider different -degrees of spatial complexity and data availability, by accounting for -active and passive dispersal of mosquitoes as well as for specific input temperature data (weather station vs. gridded temperature data from remote sense). +degrees of spatial complexity and data availability, for example by accounting for +active and passive dispersal of mosquitoes or for specific input temperature data (weather station vs. gridded remotely-sensed temperature data). The main features of **dynamAedes** are: -- It's a stochastic model: the distribution of resulting metrics (e.g., number of adults) depends on the number of iterations. +- It allows to simulate the active and passive dispersal of adult mosquitoes (when *scale="local"*). -- At local scale, **dynamAedes** allows to simulate the active and passive dispersal of adult mosquitoes. +- It's a stochastic model, thus the distribution of its output metrics (e.g., number of adults) integrates "random" variation and can thus differ slightly between different model runs. -- It has four functions (*psi*, *adci*, *dici* and *icci*) to derive metrics on the space-time trends of the simulated populations, e.g., the 95% CI - of the dispersal in a given period or the number of colonized cells. +- It provides four functions (*psi*, *adci*, *dici* and *icci*) to easily derive summary metrics (i.g., based on user-defines quantiles) on the space-time trend of the simulated population dynamics, e.g., the 95% CI of the population dispersal in a given period or the number of cells colonised. ## Installation diff --git a/cran-comments.md b/cran-comments.md index 7678003..d7d59c0 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -3,4 +3,4 @@ 0 errors | 0 warnings | 0 note * This is a new release. All checks run. -* All the issues that caused dynamAedes's archiviation were solved. \ No newline at end of file +* This package was removed from CRAN because depended on "insol" which became obsolete. I've now removed all the dependencies from "insol" package. \ No newline at end of file diff --git a/docs/404.html b/docs/404.html index 20d2e2c..55a36d2 100644 --- a/docs/404.html +++ b/docs/404.html @@ -18,6 +18,7 @@ + Articles • dynamAedesArticles • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/authors.html b/docs/authors.html index 95717c8..4453889 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,5 +1,5 @@ -Authors and Citation • dynamAedesAuthors and Citation • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/index.html b/docs/index.html index 0c367cb..f9d6f18 100644 --- a/docs/index.html +++ b/docs/index.html @@ -18,7 +18,8 @@ - + + Changelog • dynamAedesChangelog • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 @@ -64,7 +64,13 @@

Changelog

- + +
  • Transitioning from ‘rgdal’ and ‘sp’ to ‘terra’
  • +
  • Transitioning from ‘insol’ to ‘geosphere’
  • +
  • Removing block-loading of ‘tidyverse’ (speeding up loading?)
  • +
+
+
  • Adding rgdal in the description
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 981084c..3b3dcd7 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -5,5 +5,5 @@ articles: dynamAedes_local: dynamAedes_local.html dynamAedes_punctual: dynamAedes_punctual.html dynamAedes_regional: dynamAedes_regional.html -last_built: 2022-11-21T10:11Z +last_built: 2023-03-29T11:04Z diff --git a/docs/reference/adci.html b/docs/reference/adci.html index 3bfb9f5..27b3cd5 100644 --- a/docs/reference/adci.html +++ b/docs/reference/adci.html @@ -1,5 +1,5 @@ -Summaries of mosquito abundance. — adci • dynamAedesSummaries of mosquito abundance. — adci • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2
diff --git a/docs/reference/adci_sp.html b/docs/reference/adci_sp.html index fafc3f6..9ddd0b6 100644 --- a/docs/reference/adci_sp.html +++ b/docs/reference/adci_sp.html @@ -1,5 +1,5 @@ -Summaries of mosquito abundance (spatial) — adci_sp • dynamAedesSummaries of mosquito abundance (spatial) — adci_sp • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/reference/dici.html b/docs/reference/dici.html index 6c19121..f8f391a 100644 --- a/docs/reference/dici.html +++ b/docs/reference/dici.html @@ -1,5 +1,5 @@ -Estimate of of mosquito dispersal — dici • dynamAedesEstimate of of mosquito dispersal — dici • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/reference/icci.html b/docs/reference/icci.html index f49c510..6c1aeed 100644 --- a/docs/reference/icci.html +++ b/docs/reference/icci.html @@ -1,5 +1,5 @@ -Number of invaded cells — icci • dynamAedesNumber of invaded cells — icci • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/reference/index.html b/docs/reference/index.html index 8bff809..0b322c3 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,5 +1,5 @@ -Function reference • dynamAedesFunction reference • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/reference/psi.html b/docs/reference/psi.html index 6347d7b..ee3d3cd 100644 --- a/docs/reference/psi.html +++ b/docs/reference/psi.html @@ -1,5 +1,5 @@ -Proportion of successful introductions — psi • dynamAedesProportion of successful introductions — psi • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/reference/psi_sp.html b/docs/reference/psi_sp.html index 7469a2f..f6a3cfb 100644 --- a/docs/reference/psi_sp.html +++ b/docs/reference/psi_sp.html @@ -1,5 +1,5 @@ -Probability of successful introduction (spatial) — psi_sp • dynamAedesProbability of successful introduction (spatial) — psi_sp • dynamAedes @@ -17,7 +17,7 @@ dynamAedes - 2.1.1 + 2.1.2 diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 670515d..09b842a 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -33,6 +33,57 @@ /reference/dici.html + + /reference/dot-DRC.beta.html + + + /reference/dot-a.a_disp.f.html + + + /reference/dot-a.gono_rate.f.html + + + /reference/dot-a.ovi_rate.f.html + + + /reference/dot-a.surv_rate.f.html + + + /reference/dot-beta.fun.html + + + /reference/dot-beta.init.html + + + /reference/dot-d.surv_rate.f.html + + + /reference/dot-e.dia_rate.f.html + + + /reference/dot-e.hatch_rate.f.html + + + /reference/dot-e.surv_rate.f.html + + + /reference/dot-euc.html + + + /reference/dot-i.ddmort_rate.f.html + + + /reference/dot-i.emer_rate.f.html + + + /reference/dot-i.surv_rate.f.html + + + /reference/dot-meuc.html + + + /reference/dot-returndis.html + /reference/dynamAedes.m.html diff --git a/inst/WORDLIST b/inst/WORDLIST index b514e36..a4bb569 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,5 +1,9 @@ Ae Aedes +DRC +Marini +OnofriAndreaPG +Oviposition PSOCK Pasaoglu Proj @@ -7,8 +11,11 @@ RasterLayer adci aegypti albopictus +aomisc +bloodmeal cellsize colums +com coords correllation degg @@ -17,11 +24,16 @@ dici dispbins dist doi +drm ecoinf endr fra +geosphere +github +gonotrophic icci idci +insol interquantile ita japonicus @@ -30,6 +42,7 @@ koreicus lat lc maxadisp +oviposition photoperiod pkgdown pol @@ -45,7 +58,9 @@ specifiying st subcompartiment successfull +terra th +tidyverse uk ws xyz diff --git a/man/dot-DRC.beta.Rd b/man/dot-DRC.beta.Rd new file mode 100644 index 0000000..78cb839 --- /dev/null +++ b/man/dot-DRC.beta.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.DRC.beta} +\alias{.DRC.beta} +\title{Function 2 to start Beta functions: Functions taken from https://github.com/OnofriAndreaPG/aomisc} +\usage{ +.DRC.beta() +} +\value{ +No return value, called for side effects in drm +} +\description{ +Function 1 to start Beta functions +} +\keyword{internal} diff --git a/man/dot-a.a_disp.f.Rd b/man/dot-a.a_disp.f.Rd new file mode 100644 index 0000000..2175794 --- /dev/null +++ b/man/dot-a.a_disp.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.a.a_disp.f} +\alias{.a.a_disp.f} +\title{Log-Normal probability density of short active dispersal} +\usage{ +.a.a_disp.f(sp, max.a.disp, disp.bins) +} +\value{ +vector of rates. +} +\description{ +Log-Normal probability density of short active dispersal from Marcantonio et al. 2019; Marini et al. 2019. 0 to 600 m with resolution of 10 m. +} +\keyword{internal} diff --git a/man/dot-a.gono_rate.f.Rd b/man/dot-a.gono_rate.f.Rd new file mode 100644 index 0000000..c347e4f --- /dev/null +++ b/man/dot-a.gono_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.a.gono_rate.f} +\alias{.a.gono_rate.f} +\title{Daily rate of gonotrophic cycle} +\usage{ +.a.gono_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Daily rate of gonotrophic cycle, i.e., daily rate of adult females completing the cycle from bloodmeal to the first day of oviposition +} +\keyword{internal} diff --git a/man/dot-a.ovi_rate.f.Rd b/man/dot-a.ovi_rate.f.Rd new file mode 100644 index 0000000..c75f20c --- /dev/null +++ b/man/dot-a.ovi_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.a.ovi_rate.f} +\alias{.a.ovi_rate.f} +\title{Oviposition rate} +\usage{ +.a.ovi_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Oviposition rate, i.e., number of eggs laid per female/day at different temperature +} +\keyword{internal} diff --git a/man/dot-a.surv_rate.f.Rd b/man/dot-a.surv_rate.f.Rd new file mode 100644 index 0000000..b5a7c7e --- /dev/null +++ b/man/dot-a.surv_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.a.surv_rate.f} +\alias{.a.surv_rate.f} +\title{Adult female daily mortality rate} +\usage{ +.a.surv_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Adult female daily mortality rate at different temperatures +} +\keyword{internal} diff --git a/man/dot-beta.fun.Rd b/man/dot-beta.fun.Rd new file mode 100644 index 0000000..0352128 --- /dev/null +++ b/man/dot-beta.fun.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.beta.fun} +\alias{.beta.fun} +\title{Function 1 to start Beta functions: Functions taken from https://github.com/OnofriAndreaPG/aomisc} +\usage{ +.beta.fun(X, b, d, Xb, Xo, Xc) +} +\value{ +No return value, called for side effects in .DRC.beta +} +\description{ +Function 1 to start Beta functions +} +\keyword{internal} diff --git a/man/dot-beta.init.Rd b/man/dot-beta.init.Rd new file mode 100644 index 0000000..71977d4 --- /dev/null +++ b/man/dot-beta.init.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.beta.init} +\alias{.beta.init} +\title{Function 3 to start Beta functions: Functions taken from https://github.com/OnofriAndreaPG/aomisc} +\usage{ +.beta.init(mCall, LHS, data) +} +\value{ +No return value, called for Beta function initiation in drm +} +\description{ +Function 1 to start Beta functions +} +\keyword{internal} diff --git a/man/dot-d.surv_rate.f.Rd b/man/dot-d.surv_rate.f.Rd new file mode 100644 index 0000000..d4067b8 --- /dev/null +++ b/man/dot-d.surv_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.d.surv_rate.f} +\alias{.d.surv_rate.f} +\title{Diapause eggs daily survival rate} +\usage{ +.d.surv_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Diapause eggs daily survival rate at different temperature +} +\keyword{internal} diff --git a/man/dot-e.dia_rate.f.Rd b/man/dot-e.dia_rate.f.Rd new file mode 100644 index 0000000..4f3c79f --- /dev/null +++ b/man/dot-e.dia_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.e.dia_rate.f} +\alias{.e.dia_rate.f} +\title{Allocation of diapause eggs} +\usage{ +.e.dia_rate.f(photo.new, sp) +} +\value{ +vector of rates. +} +\description{ +Allocation of diapause eggs dependent on photoperiod +} +\keyword{internal} diff --git a/man/dot-e.hatch_rate.f.Rd b/man/dot-e.hatch_rate.f.Rd new file mode 100644 index 0000000..40e0afd --- /dev/null +++ b/man/dot-e.hatch_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.e.hatch_rate.f} +\alias{.e.hatch_rate.f} +\title{Egg hatching rate} +\usage{ +.e.hatch_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Egg hatching rate: this rate decides embryonated eggs which hatch or stay +} +\keyword{internal} diff --git a/man/dot-e.surv_rate.f.Rd b/man/dot-e.surv_rate.f.Rd new file mode 100644 index 0000000..6a5f2e2 --- /dev/null +++ b/man/dot-e.surv_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.e.surv_rate.f} +\alias{.e.surv_rate.f} +\title{Egg daily survival rate} +\usage{ +.e.surv_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Egg daily survival rate at different temperature +} +\keyword{internal} diff --git a/man/dot-euc.Rd b/man/dot-euc.Rd new file mode 100644 index 0000000..3b4e97e --- /dev/null +++ b/man/dot-euc.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.euc} +\alias{.euc} +\title{Euclidean distance} +\usage{ +.euc(xs, ys) +} +\value{ +float. An euclidean distance. +} +\description{ +Return Euclidean distance +} +\keyword{internal} diff --git a/man/dot-i.ddmort_rate.f.Rd b/man/dot-i.ddmort_rate.f.Rd new file mode 100644 index 0000000..9cfec76 --- /dev/null +++ b/man/dot-i.ddmort_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.i.ddmort_rate.f} +\alias{.i.ddmort_rate.f} +\title{Immature Density-dependent mortality rate} +\usage{ +.i.ddmort_rate.f(dens.new) +} +\value{ +vector of rates. +} +\description{ +Immature Density-dependent mortality +} +\keyword{internal} diff --git a/man/dot-i.emer_rate.f.Rd b/man/dot-i.emer_rate.f.Rd new file mode 100644 index 0000000..1d26420 --- /dev/null +++ b/man/dot-i.emer_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.i.emer_rate.f} +\alias{.i.emer_rate.f} +\title{Immature daily emergence rate} +\usage{ +.i.emer_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Immature daily emergence rate at different temperature +} +\keyword{internal} diff --git a/man/dot-i.surv_rate.f.Rd b/man/dot-i.surv_rate.f.Rd new file mode 100644 index 0000000..6aadd5d --- /dev/null +++ b/man/dot-i.surv_rate.f.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.i.surv_rate.f} +\alias{.i.surv_rate.f} +\title{Immature daily survival rat} +\usage{ +.i.surv_rate.f(temp.new, sp) +} +\value{ +vector of rates. +} +\description{ +Immature daily survival rate at different temperature +} +\keyword{internal} diff --git a/man/dot-meuc.Rd b/man/dot-meuc.Rd new file mode 100644 index 0000000..4a760bc --- /dev/null +++ b/man/dot-meuc.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.meuc} +\alias{.meuc} +\title{Euclidean distance from a pair of coordinates} +\usage{ +.meuc(c1, c2, coords) +} +\value{ +float. Vector of Euclidean distances. +} +\description{ +Returns Euclidean distance from a pair of coordinates +} +\keyword{internal} diff --git a/man/dot-returndis.Rd b/man/dot-returndis.Rd new file mode 100644 index 0000000..958a238 --- /dev/null +++ b/man/dot-returndis.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/internal-helpers.R +\name{.returndis} +\alias{.returndis} +\title{Distance moved by mosquito populations} +\usage{ +.returndis(distl = NA, days = NA, breaks = breaks) +} +\value{ +vector of quantiles of distances. +} +\description{ +Return quantiles of distance moved by mosquito populations +} +\keyword{internal} diff --git a/man/figures/logo.png b/man/figures/logo.png new file mode 100644 index 0000000..10c80c1 Binary files /dev/null and b/man/figures/logo.png differ diff --git a/vignettes/dynamAedes_local.Rmd b/vignettes/dynamAedes_local.Rmd index 2875347..a8f9bdc 100644 --- a/vignettes/dynamAedes_local.Rmd +++ b/vignettes/dynamAedes_local.Rmd @@ -26,15 +26,15 @@ We will describe the model applications for *Ae. albopictus* and for all spatial ```{r, message=FALSE, warning=FALSE} #Load packages require(spatstat) -require(sp) require(gstat) require(parallel) require(eesim) -require(tidyverse) +require(dplyr) require(geosphere) require(ggplot2) -require(rgeos) -#require(rgdal) +require(terra) +require(rgdal) +require(raster) require(dynamAedes) Sys.setlocale("LC_TIME", "en_GB.UTF-8") diff --git a/vignettes/dynamAedes_punctual.Rmd b/vignettes/dynamAedes_punctual.Rmd index b91dc12..493cf8f 100644 --- a/vignettes/dynamAedes_punctual.Rmd +++ b/vignettes/dynamAedes_punctual.Rmd @@ -25,15 +25,15 @@ We will describe the model applications for *Ae. albopictus* and for all spatial ```{r, message=FALSE, warning=FALSE} #Load packages require(spatstat) -require(sp) require(gstat) require(parallel) require(eesim) -require(tidyverse) +require(dplyr) require(geosphere) require(ggplot2) -require(rgeos) -#require(rgdal) +require(terra) +require(rgdal) +require(raster) require(dynamAedes) Sys.setlocale("LC_TIME", "en_GB.UTF-8") diff --git a/vignettes/dynamAedes_regional.Rmd b/vignettes/dynamAedes_regional.Rmd index d2feaba..4c85fd8 100644 --- a/vignettes/dynamAedes_regional.Rmd +++ b/vignettes/dynamAedes_regional.Rmd @@ -25,15 +25,15 @@ We will describe the model applications for *Ae. albopictus* and for all spatial ```{r, message=FALSE, warning=FALSE} #Load packages require(spatstat) -require(sp) require(gstat) require(parallel) require(eesim) -require(tidyverse) +require(dplyr) require(geosphere) require(ggplot2) -require(rgeos) -#require(rgdal) +require(terra) +require(rgdal) +require(raster) require(dynamAedes) Sys.setlocale("LC_TIME", "en_GB.UTF-8")