Running ‘testthat.R’ [36s/15s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(segregation)
  > 
  > test_check("segregation")
  ..
  ....
  ........
  .
  ..
  ..
  ..........
  ....
  ..
  .....
  ...
  ....
  ...
  ......
  ..
  ....
  ..
  ....
  ....
  ..
  .
  
  .....
  .....
  ...
  .
  .............
  ..
  ...................
  ......
  ...................
  ......
  ..........
  ..........
  ..........
  ── 1. Error: between + within = total (@test_mutual_total.R#53)  ───────────────
  subscript out of bounds
  1: expect_equal(mutual_total(test_data, "u", "g", weight = "n")[["M", "est"]], mutual_total(test_data, 
         "u", "supergroup", weight = "n")[["M", "est"]] + mutual_total(test_data, "u", 
         "g", within = "supergroup", weight = "n")[["M", "est"]]) at testthat/test_mutual_total.R:53
  2: quasi_label(enquo(object), label)
  3: eval_bare(get_expr(quo), get_env(quo))
  4: mutual_total(test_data, "u", "g", weight = "n")[["M", "est"]]
  5: `[[.tbl_df`(mutual_total(test_data, "u", "g", weight = "n"), "M", "est")
  6: NextMethod()
  7: `[[.data.frame`(mutual_total(test_data, "u", "g", weight = "n"), "M", "est")
  
  ── 2. Error: within estimations are correct (@test_mutual_total.R#68)  ─────────
  subscript out of bounds
  1: expect_equal(p_12 * mutual_total(test_data[test_data$supergroup == 12, ], "u", "g", 
         weight = "n")[["M", "est"]] + p_34 * mutual_total(test_data[test_data$supergroup == 
         34, ], "u", "g", weight = "n")[["M", "est"]], mutual_total(test_data, "u", "g", 
         within = "supergroup", weight = "n")[["M", "est"]]) at testthat/test_mutual_total.R:68
  2: quasi_label(enquo(object), label)
  3: eval_bare(get_expr(quo), get_env(quo))
  4: mutual_total(test_data[test_data$supergroup == 12, ], "u", "g", weight = "n")[["M", 
         "est"]]
  5: `[[.tbl_df`(mutual_total(test_data[test_data$supergroup == 12, ], "u", "g", weight = "n"), 
         "M", "est")
  6: NextMethod()
  7: `[[.data.frame`(mutual_total(test_data[test_data$supergroup == 12, ], "u", "g", weight = "n"), 
         "M", "est")
  
  ── 3. Error: H is correct (@test_mutual_total.R#78)  ───────────────────────────
  subscript out of bounds
  1: expect_equal(ret[["H", "est"]] >= 0 & ret[["H", "est"]] <= 1, TRUE) at testthat/test_mutual_total.R:78
  2: quasi_label(enquo(object), label)
  3: eval_bare(get_expr(quo), get_env(quo))
  4: ret[["H", "est"]]
  5: `[[.tbl_df`(ret, "H", "est")
  6: NextMethod()
  7: `[[.data.frame`(ret, "H", "est")
  
  ..........
  ..........
  ..........
  ── 4. Error: zero weights no problem (@test_mutual_total.R#101)  ───────────────
  subscript out of bounds
  1: expect_equal(mutual_total(test_data, "u", "g", weight = "n")[["M", "est"]], log(2)) at testthat/test_mutual_total.R:101
  2: quasi_label(enquo(object), label)
  3: eval_bare(get_expr(quo), get_env(quo))
  4: mutual_total(test_data, "u", "g", weight = "n")[["M", "est"]]
  5: `[[.tbl_df`(mutual_total(test_data, "u", "g", weight = "n"), "M", "est")
  6: NextMethod()
  7: `[[.data.frame`(mutual_total(test_data, "u", "g", weight = "n"), "M", "est")
  
  ..........
  ── 5. Error: between + within = total (@test_mutual_within.R#24)  ──────────────
  subscript out of bounds
  1: total[["M", "est"]] at testthat/test_mutual_within.R:24
  2: `[[.tbl_df`(total, "M", "est") at testthat/test_mutual_within.R:24
  3: NextMethod()
  4: `[[.data.frame`(total, "M", "est")
  
  ..........
  ..........
  ── 6. Error: option wide works (@test_mutual_within.R#63)  ─────────────────────
  subscript out of bounds
  1: expect_equal(total[["M", "est"]], sum(nowide[nowide$stat == "M", "est"] * nowide[nowide$stat == 
         "p", "est"])) at testthat/test_mutual_within.R:63
  2: quasi_label(enquo(object), label)
  3: eval_bare(get_expr(quo), get_env(quo))
  4: total[["M", "est"]]
  5: `[[.tbl_df`(total, "M", "est")
  6: NextMethod()
  7: `[[.data.frame`(total, "M", "est")
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 157 SKIPPED: 0 FAILED: 6
  1. Error: between + within = total (@test_mutual_total.R#53) 
  2. Error: within estimations are correct (@test_mutual_total.R#68) 
  3. Error: H is correct (@test_mutual_total.R#78) 
  4. Error: zero weights no problem (@test_mutual_total.R#101) 
  5. Error: between + within = total (@test_mutual_within.R#24) 
  6. Error: option wide works (@test_mutual_within.R#63) 
  
  Error: testthat unit tests failed
  Execution halted