tests/testthat/test-plot_distances.R

test_that("geo_distances", {
    mt_shp <- system.file("extdata/shapefiles/mato_grosso/mt.shp",
        package = "sits"
    )
    mt_sf <- sf::read_sf(mt_shp)

    distances <- sits_geo_dist(samples = samples_modis_ndvi, roi = mt_sf)

    expect_true("geo_distances" %in% class(distances))
    ss <- as.vector(dplyr::filter(
        distances,
        type == "sample-to-sample"
    )$distance)
    expect_true(mean(ss) > 5000.)
    p <- plot(distances)
    expect_equal(p$labels$title, "Distribution of Nearest Neighbor Distances")
})

Try the sits package in your browser

Any scripts or data that you put into this service are public.

sits documentation built on Nov. 2, 2023, 5:59 p.m.