From 49c70f21b5e5e133d5260060673959b5326a4d00 Mon Sep 17 00:00:00 2001 From: Alexandre Courtiol Date: Mon, 25 Sep 2023 09:42:19 +0200 Subject: [PATCH] elevatr moved to Suggests. Fixes #157 --- IsoriX/DESCRIPTION | 2 +- IsoriX/R/getelev.R | 5 +++++ IsoriX/inst/NEWS.Rd | 1 + README.md | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/IsoriX/DESCRIPTION b/IsoriX/DESCRIPTION index e90a2b2..57d1b81 100644 --- a/IsoriX/DESCRIPTION +++ b/IsoriX/DESCRIPTION @@ -11,7 +11,6 @@ Authors@R: c( Depends: R (>= 3.5.0) Imports: - elevatr, graphics, grDevices, grid, @@ -35,6 +34,7 @@ Description: Building isoscapes using mixed models and inferring the geographic plotting the maps produced with 'terra' using 'lattice'. License: GPL (>= 2) Suggests: + elevatr, colorspace, gmp, magick, diff --git a/IsoriX/R/getelev.R b/IsoriX/R/getelev.R index 8fc3c25..7c59eab 100644 --- a/IsoriX/R/getelev.R +++ b/IsoriX/R/getelev.R @@ -71,6 +71,11 @@ getelev <- function(file = "~/elevation_world_z5.tif", ... ) { + ## Checking that elevatr is installed + if (!requireNamespace("elevatr", quietly = TRUE)) { + stop("You must install the package elevatr for this function to run: `install.packages('elevatr')`") + } + ## Turning path into canonical form ## (this avoids the problem of using the wrong slashes and so on) file <- normalizePath(file, mustWork = FALSE) diff --git a/IsoriX/inst/NEWS.Rd b/IsoriX/inst/NEWS.Rd index 13e0d33..234e534 100644 --- a/IsoriX/inst/NEWS.Rd +++ b/IsoriX/inst/NEWS.Rd @@ -35,6 +35,7 @@ \subsection{Geeky change}{ \itemize{ \item \code{OceanMask} and \code{CountryBorders} are no longer stored as RDA files in \code{/data}, but as RDS files in \code{/extata} since objects created with \pkg{terra} cannot be saved as RDA files. These files are automatically loaded when the package is attached. + \item \pkg{elevatr} moved from Imports to Suggests (#157) } } } diff --git a/README.md b/README.md index 9026dac..0449b80 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ You can download and install the stable version of IsoriX directly from within R install.packages("IsoriX", dependencies = TRUE) ``` -Note: if you get into troubles due to `gmp`, `magick`, `rgl`, `testthat`, or `webshot2` retry using simply: +Note: if you get into troubles due to `elevatr`, `gmp`, `magick`, `rgl`, `testthat`, or `webshot2` retry using simply: ```R install.packages("IsoriX")