Running ‘testthat.R’ [5s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(balance)
  > 
  > test_check("balance")
  ── 1. Error: (unknown) (@test-output.R#8)  ─────────────────────────────────────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: balance(expenditures, y1) at testthat/test-output.R:8
  2: balance.plot(...)
  3: cbind(ggplot2::ggplotGrob(balance.partition), ggplot2::ggplotGrob(balance.distribution), 
         size = "first")
  4: ggplot2::ggplotGrob(balance.partition)
  5: ggplot_gtable(ggplot_build(x))
  6: ggplot_gtable.ggplot_built(ggplot_build(x))
  7: build_guides(plot$scales, plot$layers, plot$mapping, position, theme, plot$guides, 
         plot$labels)
  8: guides_gengrob(gdefs, theme)
  9: lapply(gdefs, guide_gengrob, theme)
  10: FUN(X[[i]], ...)
  ...
  18: pushvpgp(x)
  19: pushgrobvp(x$vp)
  20: pushgrobvp.viewport(x$vp)
  21: pushViewport(vp, recording = FALSE)
  22: lapply(vps, push.vp, recording)
  23: FUN(X[[i]], ...)
  24: push.vp.vpTree(X[[i]], ...)
  25: push.vp(vp$parent, recording)
  26: push.vp.viewport(vp$parent, recording)
  27: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 2. Error: (unknown) (@test-sort.R#8)  ───────────────────────────────────────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: balance(expenditures, y1) at testthat/test-sort.R:8
  2: balance.plot(...)
  3: cbind(ggplot2::ggplotGrob(balance.partition), ggplot2::ggplotGrob(balance.distribution), 
         size = "first")
  4: ggplot2::ggplotGrob(balance.partition)
  5: ggplot_gtable(ggplot_build(x))
  6: ggplot_gtable.ggplot_built(ggplot_build(x))
  7: build_guides(plot$scales, plot$layers, plot$mapping, position, theme, plot$guides, 
         plot$labels)
  8: guides_gengrob(gdefs, theme)
  9: lapply(gdefs, guide_gengrob, theme)
  10: FUN(X[[i]], ...)
  ...
  18: pushvpgp(x)
  19: pushgrobvp(x$vp)
  20: pushgrobvp.viewport(x$vp)
  21: pushViewport(vp, recording = FALSE)
  22: lapply(vps, push.vp, recording)
  23: FUN(X[[i]], ...)
  24: push.vp.vpTree(X[[i]], ...)
  25: push.vp(vp$parent, recording)
  26: push.vp.viewport(vp$parent, recording)
  27: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 8 SKIPPED: 0 FAILED: 2
  1. Error: (unknown) (@test-output.R#8) 
  2. Error: (unknown) (@test-sort.R#8) 
  
  Error: testthat unit tests failed
  Execution halted