test_that("default behavior", { "unprojected" expect_equal( sf::st_coordinates(mean_center(x)), sf::st_coordinates(sf::st_centroid(sf::st_union(x))) ) "projected" expect_equal( sf::st_coordinates(mean_center(x_proj)), sf::st_coordinates(sf::st_centroid(sf::st_union(x_proj))) ) }) test_that("weighted behavior", { "unprojected" expect_equal( sf::st_coordinates(mean_center(x, weight = "wts")), sf::st_coordinates(sf::st_centroid(sf::st_union(x_rep))) ) "projected" expect_equal( sf::st_coordinates(mean_center(x_proj, weight = "wts")), sf::st_coordinates(sf::st_centroid(sf::st_union(x_rep_proj))) ) }) test_that("group behavior", { "unprojected" expect_equal( sf::st_coordinates(mean_center(x, group = "grp")), sf::st_coordinates(sf::st_centroid(x_grp)) ) "projected" expect_equal( sf::st_coordinates(mean_center(x_proj, group = "grp")), sf::st_coordinates(sf::st_centroid(x_grp_proj)) ) }) test_that("weights and group behavior", { "unprojected" expect_equal( sf::st_coordinates(mean_center(x, group = "grp", weight = "wts")), sf::st_coordinates(sf::st_centroid(x_rep_grp)) ) "projected" expect_equal( sf::st_coordinates(mean_center(x_proj, group = "grp", weight = "wts")), sf::st_coordinates(sf::st_centroid(x_rep_grp_proj)) ) })