<rlib_error_package_not_found/rlang_error/error/condition>
Error in `ww_multi_scale_raster_args(data = data, truth = truth, estimate = estimate, 
    metrics = metrics, grids = grids, ..., na_rm = na_rm, aggregation_function = aggregation_function, 
    autoexpand_grid = autoexpand_grid, progress = progress)`: The package "exactextractr" is required.

ames_sf <- sf::st_as_sf(ames, coords = c("Longitude", "Latitude"), crs = 4326)
ames_model <- lm(Sale_Price ~ Lot_Area, data = ames_sf)
sf::st_make_grid(embiggened_bbox, n = c(20, 20), square = FALSE),
sf::st_make_grid(embiggened_bbox, n = c(10, 10), square = FALSE),
sf::st_make_grid(embiggened_bbox, n = c(1, 1), square = FALSE)
made_w_grids <- ww_multi_scale(ames_sf, Sale_Price, predictions, grids = grids)
guerry_lm <- lm(Crm_prs ~ Litercy, guerry_modeled)
test_that("srr: expected failures for ww_multi_scale", {
lm(response ~ bio2 * bio10 * bio13 * bio19, data = worldclim_simulation),
#' @srrstats {G5.8b} Data of unsupported types
#' @srrstats {G2.1} Truth and estimate are numeric:
ww_multi_scale(worldclim_predicted, predicted, response, n = c(2, 4)),
ww_multi_scale(worldclim_predicted, response, predicted, n = c(2, 4)),
#' @srrstats {G2.12} List column inputs fail:
#' @srrstats {G2.13} Missing data is properly handled
#' @srrstats {G2.15} Missingness is checked
#' @srrstats {G2.14} Users can specify behavior with NA results
#' @srrstats {G2.16} NaN is properly handled
ww_multi_scale(worldclim_predicted, predicted, response, n = 2)
ww_multi_scale(worldclim_predicted, response, predicted, n = 2),
ww_multi_scale(worldclim_predicted, predicted, response, n = 2, na_rm = FALSE)
ww_multi_scale(worldclim_predicted, response, predicted, n = 2, na_rm = FALSE),
#' @srrstats {G5.8} Edge condition tests
ww_multi_scale(head(worldclim_predicted, 0), response, predicted, n = c(2, 4)),
ww_multi_scale(head(worldclim_predicted, 0), predicted, response, n = c(2, 4)),
ww_multi_scale(worldclim_simulation, response, response, n = c(2, 4))
test_that("other generic srr standards", {
noised_worldclim <- worldclim_predicted + rnorm(
#' @srrstats {G3.0} Testing with appropriate tolerances.
#' @srrstats {G5.9} Noise susceptibility tests
#' @srrstats {G5.9a} Trivial noise doesn't change results:
ww_multi_scale(worldclim_predicted, response, predicted, n = c(2, 4))
ww_multi_scale(noised_worldclim, response, predicted, n = c(2, 4))
ww_multi_scale(worldclim_predicted, predicted, response, n = c(2, 4))
ww_multi_scale(noised_worldclim, predicted, response, n = c(2, 4))
#' @srrstats {G5.9b} Different seeds are equivalent:
#' @srrstats {SP2.3} Testing that loading data is equivalent
ww_multi_scale(worldclim_predicted, bio13, bio19, n = c(2, 4))$.estimate
#' @srrstats {SP4.1} CRS (and therefore units) is preserved
ww_multi_scale(worldclim_simulation, bio13, bio19, n = c(2, 4))$.grid[[1]]
proj_grid <- sf::st_make_grid(guerry, n = 2)
#' @srrstats {SP6.1} Testing with both projected and geographic CRS
#' @srrstats {SP6.1b} Testing with both projected and geographic CRS
#' @srrstats {SP6.2} Testing with ~global data
ww_multi_scale(truth = r1, estimate = r2, metrics = yardstick::rmse, n = 1)$.estimate,
ww_multi_scale(truth = r1, estimate = r1, metrics = yardstick::rmse, n = 1)$.estimate,
ww_multi_scale(r3, truth = 1, estimate = 2, metrics = yardstick::rmse, n = 1)$.estimate,
ww_multi_scale(r3, truth = 1, estimate = 1, metrics = yardstick::rmse, n = 1)$.estimate,
test_that("raster method is equivalent", {
sf_method <- ww_multi_scale(z, lyr.1, lyr.1.1, n = 2)
terra_method <- ww_multi_scale(truth = x, estimate = y, n = 2)
terra_data_method <- ww_multi_scale(c(x, y), truth = 1, estimate = 2, n = 2)
expect_identical(sf_method, terra_method, tolerance = 1e-6)
expect_identical(sf_method, terra_data_method, tolerance = 1e-6)
test_that("raster method errors as expected", {
ww_multi_scale(truth = terra::rast(r1), estimate = 1),
ww_multi_scale(truth = terra::rast(r1), estimate = c(terra::rast(r1), terra::rast(r1))),
test_that("sf method supports quoted names", {
test_that("units are handled properly", {
cellsizes <- units::set_units(seq(20, 100, 10), "km")
vapply(cellsizes, function(cellsize) length(sf::st_make_grid(pts, cellsize, square = FALSE)), integer(1))
test_that("counts of non-NA values are correct", {
test_that("counts are the same whether or not column names are quoted", {
test_that("using protected names triggers errors", {
test_that("Data with an NA CRS works", {
test_that("Passing crs via `...` warns", {
test_that("Passing arguments via `...` errors when using grids", {
test_that("ww_multi_scale with raster args can handle classification metrics (#60)", {
l1 <- terra::rast(matrix(sample(1:10, 100, TRUE), nrow = 10))
test_that("ww_multi_scale with raster data can handle classification metrics (#60)", {
test_that("ww_multi_scale with raster args can handle class prob metrics", {
matrix(sample(1:2, 100, TRUE), nrow = 10)
test_that("ww_multi_scale with raster data can handle class prob metrics", {
test_that("ww_multi_scale with rasters fails if metrics are mixed", {