|
1 | 1 | test_that("canonical arrangement works", {
|
2 | 2 | tib <- tibble(
|
3 | 3 | x = 1:8,
|
4 |
| - y = rep(c("b", "b", "a", "a"), times = 2), |
| 4 | + demo_grp = rep(c("b", "b", "a", "a"), times = 2), |
5 | 5 | geo_value = rep(c("ga", "ca"), each = 4),
|
6 | 6 | time_value = rep(2:1, times = 4)
|
7 | 7 | )
|
8 | 8 | expect_warning(arrange_canonical(tib))
|
9 | 9 |
|
10 |
| - tib <- tib %>% as_epi_df(additional_metadata = list(other_keys = "y")) |
11 |
| - expect_equal(names(tib), c("geo_value", "time_value", "x", "y")) |
| 10 | + tib <- tib %>% as_epi_df(additional_metadata = list(other_keys = "demo_grp")) |
| 11 | + expect_equal(names(tib), c("geo_value", "time_value", "x", "demo_grp")) |
12 | 12 |
|
13 | 13 | tib_sorted <- arrange_canonical(tib)
|
14 |
| - expect_equal(names(tib_sorted), c("geo_value", "time_value", "y", "x")) |
| 14 | + expect_equal(names(tib_sorted), c("geo_value", "time_value", "demo_grp", "x")) |
15 | 15 | expect_equal(tib_sorted$geo_value, rep(c("ca", "ga"), each = 4))
|
16 | 16 | expect_equal(tib_sorted$time_value, c(1, 1, 2, 2, 1, 1, 2, 2))
|
17 |
| - expect_equal(tib_sorted$y, rep(letters[1:2], times = 4)) |
| 17 | + expect_equal(tib_sorted$demo_grp, rep(letters[1:2], times = 4)) |
18 | 18 | expect_equal(tib_sorted$x, c(8, 6, 7, 5, 4, 2, 3, 1))
|
19 | 19 | })
|
0 commit comments