Skip to content

Commit

Permalink
cran fixes and snow rm
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainschmitt committed Oct 24, 2023
1 parent 8d7cdf6 commit 58f669b
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 42 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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<-")
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions R/ensemble_modelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion R/mapDiversity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions R/modelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.} }
Expand All @@ -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}
Expand Down Expand Up @@ -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")
Expand Down
7 changes: 3 additions & 4 deletions R/stack_modelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
13 changes: 2 additions & 11 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion man/ensemble_modelling.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/mapDiversity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions man/modelling.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/stack_modelling.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test_parallel_ESDM.R
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
2 changes: 1 addition & 1 deletion tests/testthat/test_parallel_SSDM.R
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
})

0 comments on commit 58f669b

Please sign in to comment.