@@ -430,11 +426,7 @@ read_GRTSmh_base4frac <-
function(file = file.path(fileman_up("n2khab_data"),
"20_processed/GRTSmh_base4frac/GRTSmh_base4frac.tif")) {
- if (!requireNamespace("raster", quietly = TRUE)) {
- stop("Package \"raster\" is needed when using this function. ",
- "Please install it.",
- call. = FALSE)
- }
+ require_pkgs("raster")
r <- raster::raster(file)
raster::crs(r) <- "EPSG:31370"
Behaviour:
> require_pkgs(c("a", "base", "b", "c"))
Error: Multiple packages needed for this function are missing.
Please install as follows: install.packages(c("a", "b", "c"))
> require_pkgs("targets")
Error: A package needed for this function is missing.
Please install as follows: install.packages("targets")
This simplifies things as follows:
Behaviour: