tests/testthat/test_file.R

library(testthat)
library(ggsegmentedtotalbar)

test_that("ggsegmentedtotalbar produces a plot", {
  df <- data.frame(
    group = c("A", "A","A","B", "B","B"),
    segment = c("X", "Y", "Z", "X", "Y", "Z"),
    value = c(10, 20, 30, 40, 50, 60),
    total = c(60, 60, 60, 150, 150, 150)
  )
  p <- ggsegmentedtotalbar(df, "group", "segment", "value", "total")
  expect_s3_class(p, "gg")
})

Try the ggsegmentedtotalbar package in your browser

Any scripts or data that you put into this service are public.

ggsegmentedtotalbar documentation built on June 8, 2025, 10:58 a.m.