tests/testthat/test.geom_interval.R

# Tests for interval geoms
#
# Author: mjskay
###############################################################################

library(dplyr)
library(tidyr)



# use a subset of RankCorr so tests are faster
data(RankCorr, package = "ggdist")
RankCorr_s = RankCorr[[1]][1:100,]
RankCorr_u_tau = RankCorr_s %>%
  spread_draws(u_tau[i]) %>%
  filter(i %in% 1:3)

test_that("horizontal grouped intervals work", {
  skip_if_no_vdiffr()


  expect_warning(vdiffr::expect_doppelganger("grouped intervals (h)",
    RankCorr_u_tau %>%
      mean_qi(.width = c(.5, .75, .90)) %>%
      ggplot(aes(y = i, x = u_tau)) +
      geom_intervalh() +
      scale_color_brewer()
  ), "Deprecated")

  expect_warning(vdiffr::expect_doppelganger("grouped intervals (h, stat)",
    RankCorr_u_tau %>%
      ggplot(aes(y = i, x = u_tau)) +
      stat_intervalh(.width = c(.5, .75, .90)) +
      scale_color_brewer()
  ), "Deprecated")
})

Try the tidybayes package in your browser

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

tidybayes documentation built on Sept. 15, 2024, 9:08 a.m.