diff --git a/R/fetchSOLUS.R b/R/fetchSOLUS.R index 544e4e1f..7da56086 100644 --- a/R/fetchSOLUS.R +++ b/R/fetchSOLUS.R @@ -227,6 +227,9 @@ fetchSOLUS <- function(x = NULL, .get_SOLUS_index <- function() { # TODO: parse XML directly instead of HTML? + if (!requireNamespace("rvest")) { + stop("package 'rvest' is required", call. = FALSE) + } # read index as HTML table res <- rvest::html_table(rvest::read_html("https://storage.googleapis.com/solus100pub/index.html"), header = FALSE)[[1]] diff --git a/tests/testthat/test-fetchSOLUS.R b/tests/testthat/test-fetchSOLUS.R index 3ee8196c..e87058f7 100644 --- a/tests/testthat/test-fetchSOLUS.R +++ b/tests/testthat/test-fetchSOLUS.R @@ -10,6 +10,8 @@ test_that("fetchSOLUS works", { skip_if_not_installed("terra") + skip_if_not_installed("rvest") + b <- c(-119.747629, -119.67935, 36.912019, 36.944987) bbox.sp <- sf::st_as_sf(wk::rct( @@ -55,6 +57,8 @@ test_that("virtual and out-of-bounds requests", { skip_if_not_installed("terra") + skip_if_not_installed("rvest") + # virtual raster for one variable*depth tmp <- fetchSOLUS(variables = "claytotal", output_type = "prediction",