# group_data -------------------------------------------------------------- test_that("group_data() returns a tibble", { df <- dplyr::tibble(x = 1:3) df_v <- dplyr::tibble( x = 1:3, lon = as.double(4:6), lat = as.double(7:9) ) df_v <- terra::vect(df_v, crs = "EPSG:4326") expect_s4_class(df_v, "SpatVector") gd_v <- group_data(df_v) expect_s3_class(gd_v, "tbl_df") expect_equal(as.list(gd_v$.rows), list(1:3)) gd <- group_data(df) expect_identical(gd_v, gd) }) test_that("Ungroup_data() returns the right value", { df <- dplyr::tibble(x = 1:3) df_v <- dplyr::tibble( x = 1:3, lon = as.double(4:6), lat = as.double(7:9) ) df_v <- terra::vect(df_v, crs = "EPSG:4326") expect_s4_class(df_v, "SpatVector") expect_identical(group_vars(df_v), character(0)) expect_identical(group_vars(df_v), dplyr::group_vars(df)) }) test_that("group_data(