From 58f669bb13aeb407c8d5153de5a51a598c5725cb Mon Sep 17 00:00:00 2001 From: Sylvain Schmitt Date: Tue, 24 Oct 2023 13:39:53 +0200 Subject: [PATCH] cran fixes and snow rm --- DESCRIPTION | 3 +-- NAMESPACE | 4 ++-- R/ensemble_modelling.R | 5 ++--- R/mapDiversity.R | 2 +- R/modelling.R | 14 +++++++------- R/stack_modelling.R | 7 +++---- cran-comments.md | 13 ++----------- man/ensemble_modelling.Rd | 2 +- man/mapDiversity.Rd | 2 +- man/modelling.Rd | 12 ++++++------ man/stack_modelling.Rd | 4 ++-- tests/testthat/test_parallel_ESDM.R | 2 +- tests/testthat/test_parallel_SSDM.R | 2 +- 13 files changed, 30 insertions(+), 42 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 70d1bc1..ce7019f 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -43,8 +43,7 @@ Imports: parallel (>= 3.5.2), leaflet (>= 2.2.0), magrittr (>= 2.0.3), - sdm (>= 1.1.8), - snow (>= 0.4-4) + sdm (>= 1.1.8) Depends: R (>= 3.2.2) Collate: diff --git a/NAMESPACE b/NAMESPACE index 38798cb..82468c0 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -69,6 +69,8 @@ importFrom(mgcv,gam) importFrom(mgcv,gam.control) importFrom(nnet,nnet) importFrom(parallel,detectCores) +importFrom(parallel,makeCluster) +importFrom(parallel,stopCluster) importFrom(poibin,dpoibin) importFrom(randomForest,randomForest) importFrom(raster,"values<-") @@ -149,8 +151,6 @@ importFrom(shinydashboard,sidebarMenuOutput) importFrom(shinydashboard,tabBox) importFrom(shinydashboard,tabItem) importFrom(shinydashboard,tabItems) -importFrom(snow,makeCluster) -importFrom(snow,stopCluster) importFrom(spThin,thin) importFrom(stats,aggregate.data.frame) importFrom(stats,cor) diff --git a/R/ensemble_modelling.R b/R/ensemble_modelling.R index e254f88..418c751 100755 --- a/R/ensemble_modelling.R +++ b/R/ensemble_modelling.R @@ -4,8 +4,7 @@ #' @importFrom foreach foreach %dopar% #' @importFrom doParallel registerDoParallel #' @importFrom iterators icount -#' @importFrom parallel detectCores -#' @importFrom snow makeCluster stopCluster +#' @importFrom parallel detectCores makeCluster stopCluster NULL #'Build an ensemble SDM that assembles multiple algorithms @@ -181,7 +180,7 @@ NULL #'@section Maximum Entropy (\strong{MAXENT}) : Uses the \code{maxent} function #' from the package 'dismo'. Make sure that you have correctly installed the #' maxent.jar file in the folder ~\\R\\library\\version\\dismo\\java available -#' at \url{https://www.cs.princeton.edu/~schapire/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). +#' at \url{https://biodiversityinformatics.amnh.org/open_source/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). #' No specific defaults are set with this method. #' #'@section Artificial Neural Network (\strong{ANN}) : Uses the \code{nnet} diff --git a/R/mapDiversity.R b/R/mapDiversity.R index 66f59a5..66bc763 100755 --- a/R/mapDiversity.R +++ b/R/mapDiversity.R @@ -65,7 +65,7 @@ NULL #' J.M. Calabrese, G. Certain, C. Kraan, & C.F. Dormann (2014) "Stacking #' species distribution models and adjusting bias by linking them to #' macroecological models." \emph{Global Ecology and Biogeography} 23:99-112 -#' \url{http://portal.uni-freiburg.de/biometrie/mitarbeiter/dormann/calabrese2013globalecolbiogeogr.pdf} +#' \url{https://onlinelibrary.wiley.com/doi/full/10.1111/geb.12102} #' #' @name mapDiversity NULL diff --git a/R/modelling.R b/R/modelling.R index aa055f3..ecbc55b 100755 --- a/R/modelling.R +++ b/R/modelling.R @@ -103,19 +103,19 @@ NULL #' \item{'...'}{See algorithm in detail section} } #' #'@section Generalized linear model (\strong{GLM}) : Uses the \code{glm} -#' function from the package 'stats'. You can set parameters by supplying \code{glm.args=list(arg1=val1,arg2=val2)} (see \code{\link[stats]{glm}} for all settable arguments). +#' function from the package 'stats'. You can set parameters by supplying \code{glm.args=list(arg1=val1,arg2=val2)} (see \code{\link[stats]{glm}} for all settable arguments). #' The following parameters have defaults: \describe{ #' \item{test}{character. Test used to evaluate the SDM, default 'AIC'.} #' \item{control}{list (created with \code{\link[stats]{glm.control}}). -#' Contains parameters for controlling the fitting process. Default is \code{glm.control(epsilon = 1e-08, maxit = 500)}. -#' 'epsilon' is a numeric and defines the positive convergence tolerance (eps). The iterations converge when \emph{|dev - dev_{old}|/(|dev| + 0.1) < eps}. +#' Contains parameters for controlling the fitting process. Default is \code{glm.control(epsilon = 1e-08, maxit = 500)}. +#' 'epsilon' is a numeric and defines the positive convergence tolerance (eps). #' 'maxit' is an integer giving the maximal number of IWLS (Iterative Weighted Last Squares) iterations.} } #' #'@section Generalized additive model (\strong{GAM}) : Uses the \code{gam} #' function from the package 'mgcv'. You can set parameters by supplying \code{gam.args=list(arg1=val1,arg2=val2)} (see \code{\link[mgcv]{gam}} for all settable arguments). #' The following parameters have defaults: \describe{\item{test}{character. #' Test used to evaluate the model, default 'AIC'.} \item{control}{list (created with \code{\link[mgcv]{gam.control}}). -#' Contains parameters for controlling the fitting process. Default is \code{gam.control(epsilon = 1e-08, maxit = 500)}. +#' Contains parameters for controlling the fitting process. Default is \code{gam.control(epsilon = 1e-08, maxit = 500)}. #' 'epsilon' is a numeric used for judging the conversion of the GLM IRLS (Iteratively Reweighted Least Squares) loop. 'maxit' is an integer giving the maximum number of IRLS iterations to perform.} } #' #'@section Multivariate adaptive regression splines (\strong{MARS}) : Uses the @@ -148,7 +148,7 @@ NULL #' function from the package 'rpart'. You can set parameters by supplying \code{cta.args=list(arg1=val1,arg2=val2)} (see \code{\link[rpart]{rpart}} for all settable arguments). #' The following parameters have defaults: \describe{ #' \item{control}{list (created with \code{\link[rpart]{rpart.control}}). -#' Contains parameters for controlling the rpart fit. The default is \code{rpart.control(minbucket=1, xval=3)}. +#' Contains parameters for controlling the rpart fit. The default is \code{rpart.control(minbucket=1, xval=3)}. #' 'mibucket' is an integer giving the minimum number of observations in any #' terminal node. 'xval' is an integer defining the number of #' cross-validations.} } @@ -164,7 +164,7 @@ NULL #'@section Maximum Entropy (\strong{MAXENT}) : Uses the \code{maxent} function #' from the package 'dismo'. Make sure that you have correctly installed the #' maxent.jar file in the folder ~\\R\\library\\version\\dismo\\java available -#' at \url{https://www.cs.princeton.edu/~schapire/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). +#' at \url{https://biodiversityinformatics.amnh.org/open_source/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). #' No specific defaults are set with this method. #' #'@section Artificial Neural Network (\strong{ANN}) : Uses the \code{nnet} @@ -372,7 +372,7 @@ modelling <- function(algorithm, Occurrences, Env, Xcol = "Longitude", if (GUI) { incProgress(1/5, detail = "SDM projected") } - + # Axes evaluation if (verbose) { cat("Model axes contribution evaluation...\n") diff --git a/R/stack_modelling.R b/R/stack_modelling.R index d318a5d..760f49d 100755 --- a/R/stack_modelling.R +++ b/R/stack_modelling.R @@ -4,8 +4,7 @@ #' @importFrom raster stack writeRaster #' @importFrom foreach foreach %dopar% #' @importFrom doParallel registerDoParallel -#' @importFrom parallel detectCores -#' @importFrom snow makeCluster stopCluster +#' @importFrom parallel detectCores makeCluster stopCluster NULL #'Build an SSDM that assembles multiple algorithms and species. @@ -162,7 +161,7 @@ NULL #' \item{test}{character. Test used to evaluate the SDM, default 'AIC'.} #' \item{control}{list (created with \code{\link[stats]{glm.control}}). #' Contains parameters for controlling the fitting process. Default is \code{glm.control(epsilon = 1e-08, maxit = 500)}. -#' 'epsilon' is a numeric and defines the positive convergence tolerance (eps). The iterations converge when \emph{|dev - dev_{old}|/(|dev| + 0.1) < eps}. +#' 'epsilon' is a numeric and defines the positive convergence tolerance (eps). #' 'maxit' is an integer giving the maximal number of IWLS (Iterative Weighted Last Squares) iterations.} } #' #'@section Generalized additive model (\strong{GAM}) : Uses the \code{gam} @@ -218,7 +217,7 @@ NULL #'@section Maximum Entropy (\strong{MAXENT}) : Uses the \code{maxent} function #' from the package 'dismo'. Make sure that you have correctly installed the #' maxent.jar file in the folder ~\\R\\library\\version\\dismo\\java available -#' at \url{https://www.cs.princeton.edu/~schapire/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). +#' at \url{https://biodiversityinformatics.amnh.org/open_source/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). #' No specific defaults are set with this method. #' #'@section Artificial Neural Network (\strong{ANN}) : Uses the \code{nnet} diff --git a/cran-comments.md b/cran-comments.md index 671213a..8bd82d2 100755 --- a/cran-comments.md +++ b/cran-comments.md @@ -5,22 +5,13 @@ ## R CMD check results -There were no ERRORs or WARNINGs. - -There was one NOTE: - - Imports includes 24 non-default packages. - Importing from so many packages makes the package vulnerable to any of - them becoming unavailable. Move as many as possible to Suggests and - use conditionally. - -The fact that we quickly updated the package following several dependency -changes shows that we are able to assume all the needed dependencies. +There were no NOTEs, ERRORs or WARNINGs. ## Resubmission This is a resubmission. In this version I have: +- removed superseded package snow - removed rgdal and sp from the package dependencies following r-spatial package archiving - updated invalid URLs - removed lost braces from documentation diff --git a/man/ensemble_modelling.Rd b/man/ensemble_modelling.Rd index 9a1e1fb..5580c88 100755 --- a/man/ensemble_modelling.Rd +++ b/man/ensemble_modelling.Rd @@ -252,7 +252,7 @@ evaluation, algorithm correlation matrix and variable importance). Uses the \code{maxent} function from the package 'dismo'. Make sure that you have correctly installed the maxent.jar file in the folder ~\\R\\library\\version\\dismo\\java available - at \url{https://www.cs.princeton.edu/~schapire/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). + at \url{https://biodiversityinformatics.amnh.org/open_source/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). No specific defaults are set with this method. } diff --git a/man/mapDiversity.Rd b/man/mapDiversity.Rd index 0829f9c..c0e2991 100755 --- a/man/mapDiversity.Rd +++ b/man/mapDiversity.Rd @@ -76,7 +76,7 @@ M. D'Amen, A. Dubuis, R. F. Fernandes, J. Pottier, L. Pelissier, & J.M. Calabrese, G. Certain, C. Kraan, & C.F. Dormann (2014) "Stacking species distribution models and adjusting bias by linking them to macroecological models." \emph{Global Ecology and Biogeography} 23:99-112 - \url{http://portal.uni-freiburg.de/biometrie/mitarbeiter/dormann/calabrese2013globalecolbiogeogr.pdf} + \url{https://onlinelibrary.wiley.com/doi/full/10.1111/geb.12102} } \seealso{ \code{\link{stacking}} to build SSDMs. diff --git a/man/modelling.Rd b/man/modelling.Rd index 7ba399c..0417b14 100755 --- a/man/modelling.Rd +++ b/man/modelling.Rd @@ -151,12 +151,12 @@ evaluation table. } \section{Generalized linear model (\strong{GLM}) }{ Uses the \code{glm} - function from the package 'stats'. You can set parameters by supplying \code{glm.args=list(arg1=val1,arg2=val2)} (see \code{\link[stats]{glm}} for all settable arguments). + function from the package 'stats'. You can set parameters by supplying \code{glm.args=list(arg1=val1,arg2=val2)} (see \code{\link[stats]{glm}} for all settable arguments). The following parameters have defaults: \describe{ \item{test}{character. Test used to evaluate the SDM, default 'AIC'.} \item{control}{list (created with \code{\link[stats]{glm.control}}). - Contains parameters for controlling the fitting process. Default is \code{glm.control(epsilon = 1e-08, maxit = 500)}. - 'epsilon' is a numeric and defines the positive convergence tolerance (eps). The iterations converge when \emph{|dev - dev_{old}|/(|dev| + 0.1) < eps}. + Contains parameters for controlling the fitting process. Default is \code{glm.control(epsilon = 1e-08, maxit = 500)}. + 'epsilon' is a numeric and defines the positive convergence tolerance (eps). 'maxit' is an integer giving the maximal number of IWLS (Iterative Weighted Last Squares) iterations.} } } @@ -165,7 +165,7 @@ evaluation table. function from the package 'mgcv'. You can set parameters by supplying \code{gam.args=list(arg1=val1,arg2=val2)} (see \code{\link[mgcv]{gam}} for all settable arguments). The following parameters have defaults: \describe{\item{test}{character. Test used to evaluate the model, default 'AIC'.} \item{control}{list (created with \code{\link[mgcv]{gam.control}}). - Contains parameters for controlling the fitting process. Default is \code{gam.control(epsilon = 1e-08, maxit = 500)}. + Contains parameters for controlling the fitting process. Default is \code{gam.control(epsilon = 1e-08, maxit = 500)}. 'epsilon' is a numeric used for judging the conversion of the GLM IRLS (Iteratively Reweighted Least Squares) loop. 'maxit' is an integer giving the maximum number of IRLS iterations to perform.} } } @@ -204,7 +204,7 @@ evaluation table. function from the package 'rpart'. You can set parameters by supplying \code{cta.args=list(arg1=val1,arg2=val2)} (see \code{\link[rpart]{rpart}} for all settable arguments). The following parameters have defaults: \describe{ \item{control}{list (created with \code{\link[rpart]{rpart.control}}). - Contains parameters for controlling the rpart fit. The default is \code{rpart.control(minbucket=1, xval=3)}. + Contains parameters for controlling the rpart fit. The default is \code{rpart.control(minbucket=1, xval=3)}. 'mibucket' is an integer giving the minimum number of observations in any terminal node. 'xval' is an integer defining the number of cross-validations.} } @@ -224,7 +224,7 @@ evaluation table. Uses the \code{maxent} function from the package 'dismo'. Make sure that you have correctly installed the maxent.jar file in the folder ~\\R\\library\\version\\dismo\\java available - at \url{https://www.cs.princeton.edu/~schapire/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). + at \url{https://biodiversityinformatics.amnh.org/open_source/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). No specific defaults are set with this method. } diff --git a/man/stack_modelling.Rd b/man/stack_modelling.Rd index 2fc66ce..bd6e1b6 100755 --- a/man/stack_modelling.Rd +++ b/man/stack_modelling.Rd @@ -231,7 +231,7 @@ variable importance), and a list of ensemble SDMs for each species (see \item{test}{character. Test used to evaluate the SDM, default 'AIC'.} \item{control}{list (created with \code{\link[stats]{glm.control}}). Contains parameters for controlling the fitting process. Default is \code{glm.control(epsilon = 1e-08, maxit = 500)}. - 'epsilon' is a numeric and defines the positive convergence tolerance (eps). The iterations converge when \emph{|dev - dev_{old}|/(|dev| + 0.1) < eps}. + 'epsilon' is a numeric and defines the positive convergence tolerance (eps). 'maxit' is an integer giving the maximal number of IWLS (Iterative Weighted Last Squares) iterations.} } } @@ -299,7 +299,7 @@ variable importance), and a list of ensemble SDMs for each species (see Uses the \code{maxent} function from the package 'dismo'. Make sure that you have correctly installed the maxent.jar file in the folder ~\\R\\library\\version\\dismo\\java available - at \url{https://www.cs.princeton.edu/~schapire/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). + at \url{https://biodiversityinformatics.amnh.org/open_source/maxent/}. As with the other algorithms, you can set parameters by supplying \code{maxent.args=list(arg1=val1,arg2=val2)}. Mind that arguments are passed from dismo to the MAXENT software again as an argument list (see \code{\link[dismo]{maxent}} for more details). No specific defaults are set with this method. } diff --git a/tests/testthat/test_parallel_ESDM.R b/tests/testthat/test_parallel_ESDM.R index b3f33e3..ef6a9b9 100644 --- a/tests/testthat/test_parallel_ESDM.R +++ b/tests/testthat/test_parallel_ESDM.R @@ -5,6 +5,6 @@ test_that('Ensemble parallelization', { ESDM <- ensemble_modelling(c('CTA', 'MARS'), Occurrences, Env, rep = 1, Xcol = 'LONGITUDE', Ycol = 'LATITUDE', ensemble.thresh = c(0), verbose = FALSE, cores = 2, - minimal.memory = TRUE, tmp = TRUE) + tmp = TRUE) expect_is(ESDM, 'Ensemble.SDM') }) diff --git a/tests/testthat/test_parallel_SSDM.R b/tests/testthat/test_parallel_SSDM.R index e0c7c0b..a9d49b6 100644 --- a/tests/testthat/test_parallel_SSDM.R +++ b/tests/testthat/test_parallel_SSDM.R @@ -5,7 +5,7 @@ test_that('Stack parallelization', { SSDM <- stack_modelling(c('CTA', 'MARS'), Occurrences, Env, rep = 1, Xcol = 'LONGITUDE', Ycol = 'LATITUDE', Spcol = 'SPECIES', ensemble.thresh = c(0), method="pSSDM", uncertainty = TRUE, - verbose = FALSE, cores = 2, parmode = i , minimal.memory = TRUE, tmp = FALSE) + verbose = FALSE, cores = 2, parmode = i , tmp = FALSE) expect_is(SSDM, 'Stacked.SDM') } })