Skip to content

Commit afcc2de

Browse files
committed
fixing errors, updating documentation and adding new capabilities to functions
1 parent 529b492 commit afcc2de

13 files changed

+6446
-17
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Imports:
4141
tidyselect,
4242
utils
4343
Suggests:
44+
ggdist,
4445
ggfortify,
4546
gridExtra (>= 2.2.1),
4647
hexbin,
@@ -55,8 +56,7 @@ Suggests:
5556
shinystan (>= 2.3.0),
5657
survival,
5758
testthat (>= 2.0.0),
58-
vdiffr (>= 1.0.2),
59-
ggdist
59+
vdiffr (>= 1.0.2)
6060
RoxygenNote: 7.3.2
6161
VignetteBuilder: knitr
6262
Encoding: UTF-8

R/ppc-distributions.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' @template args-pit-ecdf
1616
#' @param size,alpha Passed to the appropriate geom to control the appearance of
1717
#' the predictive distributions.
18-
#' @param ... Currently unused.
18+
#' @param ... For dot plots, optional additional arguments to pass to [ggdist::stat_dots()].
1919
#'
2020
#' @template details-binomial
2121
#' @template return-ggplot-or-data
@@ -525,7 +525,7 @@ ppc_qdotplot <-
525525
binwidth = NA,
526526
quantiles = NA,
527527
freq = TRUE) {
528-
check_ignored_arguments(...)
528+
check_ignored_arguments(..., ok_args = c("dotsize", "layout", "stackratio", "overflow"))
529529

530530
suggested_package("ggdist")
531531

@@ -539,7 +539,7 @@ ppc_qdotplot <-
539539
ggdist::stat_dots(
540540
binwidth = binwidth,
541541
quantiles = quantiles,
542-
overflow = "warn"
542+
...
543543
) +
544544
scale_fill_ppc() +
545545
scale_color_ppc() +

R/ppd-distributions.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ ppd_qdotplot <-
195195
binwidth = NA,
196196
quantiles = NA,
197197
freq = TRUE) {
198-
check_ignored_arguments(...)
198+
check_ignored_arguments(..., ok_args = c("dotsize", "layout", "stackratio", "overflow"))
199199

200200
suggested_package("ggdist")
201201

@@ -208,7 +208,7 @@ ppd_qdotplot <-
208208
ggdist::stat_dots(
209209
binwidth = binwidth,
210210
quantiles = quantiles,
211-
overflow = "warn"
211+
...
212212
) +
213213
scale_color_ppd() +
214214
scale_fill_ppd() +

man-roxygen/args-qdotplot.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
#' @param quantiles For dot plots, optional integer `quantiles` defines the
2-
#' number of quantiles to plot in dot plot to produce a quantile dot plot.
3-
#' If `quantiles` is `NA` (the default) then all data points are plotted.
1+
#' @param quantiles For dot plots, an optional integer passed to
2+
#' [ggdist::stat_dots()] specifying the number of quantiles to use for a
3+
#' quantile dot plot. If `quantiles` is `NA` (the default) then all data
4+
#' points are plotted.

tests/testthat/_snaps/ppc-distributions/ppc-qdotplot-binwidth.new.svg

Lines changed: 853 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppc-qdotplot-default.new.svg

Lines changed: 1136 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppc-qdotplot-quantile-binwidth.new.svg

Lines changed: 704 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppc-qdotplot-quantile.new.svg

Lines changed: 704 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppd-qdotplot-binwidth.new.svg

Lines changed: 720 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppd-qdotplot-default.new.svg

Lines changed: 1025 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppd-qdotplot-quantile-binwidth.new.svg

Lines changed: 639 additions & 0 deletions
Loading

tests/testthat/_snaps/ppc-distributions/ppd-qdotplot-quantile.new.svg

Lines changed: 643 additions & 0 deletions
Loading

tests/testthat/test-ppc-distributions.R

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ test_that("ppc_qdotplot returns a ggplot object", {
6262
testthat::skip_if_not_installed("ggdist")
6363

6464
expect_gg(ppc_qdotplot(y, yrep[1:8, ]))
65-
expect_gg(ppc_qdotplot(y, yrep[1,, drop = FALSE], quantiles=25))
65+
expect_gg(ppc_qdotplot(y, yrep[1,, drop = FALSE], quantiles = 25))
6666
expect_gg(ppc_qdotplot(y, yrep[1:8, ], binwidth = 0.1))
6767
expect_gg(ppc_qdotplot(y2, yrep2, binwidth = 0.1, quantiles = 25))
6868

69-
7069
# ppd versions
71-
expect_gg(ppd_qdotplot(y, yrep[1:8, ]))
70+
expect_gg(ppd_qdotplot(yrep[1:8, ]))
7271
expect_gg(ppd_qdotplot(yrep[1,, drop = FALSE], quantiles = 25))
7372
expect_gg(ppd_qdotplot(yrep[1:8, ], binwidth = 0.1))
7473
expect_gg(ppd_qdotplot(yrep2, binwidth = 0.1, quantiles = 25))
74+
7575
})
7676

7777
test_that("ppc_pit_ecdf, ppc_pit_ecdf_grouped returns a ggplot object", {
@@ -203,26 +203,30 @@ test_that("ppc_qdotplot renders correctly", {
203203
vdiffr::expect_doppelganger("ppc_qdotplot (default)", p_base)
204204

205205
p_binwidth <- ppc_qdotplot(vdiff_y, vdiff_yrep[1:8, ], binwidth = 3)
206-
vdiffr::expect_doppelganger("ppc_qdotplot (binwidth)", p_binwidth)
206+
expect_warning(vdiffr::expect_doppelganger("ppc_qdotplot (binwidth)", p_binwidth),
207+
"The provided binwidth will cause dots to overflow the boundaries of the geometry.")
207208

208209
p_quantile <- ppc_qdotplot(vdiff_y, vdiff_yrep[1:8, ], quantiles = 50)
209210
vdiffr::expect_doppelganger("ppc_qdotplot (quantile)", p_quantile)
210211

211212
p_quantile_binwidth <- ppc_qdotplot(vdiff_y, vdiff_yrep[1:8, ], binwidth = 3, quantiles = 50)
212-
vdiffr::expect_doppelganger("ppc_qdotplot (quantile-binwidth)", p_quantile_binwidth)
213+
expect_warning(vdiffr::expect_doppelganger("ppc_qdotplot (quantile-binwidth)", p_quantile_binwidth),
214+
"The provided binwidth will cause dots to overflow the boundaries of the geometry.")
213215

214216
# ppd versions
215217
p_base <- ppd_qdotplot(vdiff_yrep[1:8, ])
216218
vdiffr::expect_doppelganger("ppd_qdotplot (default)", p_base)
217219

218220
p_binwidth <- ppd_qdotplot(vdiff_yrep[1:8, ], binwidth = 3)
219-
vdiffr::expect_doppelganger("ppd_qdotplot (binwidth)", p_binwidth)
221+
expect_warning(vdiffr::expect_doppelganger("ppd_qdotplot (binwidth)", p_binwidth),
222+
"The provided binwidth will cause dots to overflow the boundaries of the geometry.")
220223

221224
p_quantile <- ppd_qdotplot(vdiff_yrep[1:8, ], quantiles = 50)
222225
vdiffr::expect_doppelganger("ppd_qdotplot (quantile)", p_quantile)
223226

224227
p_quantile_binwidth <- ppd_qdotplot(vdiff_yrep[1:8, ], binwidth = 3, quantiles = 50)
225-
vdiffr::expect_doppelganger("ppd_qdotplot (quantile-binwidth)", p_quantile_binwidth)
228+
expect_warning(vdiffr::expect_doppelganger("ppd_qdotplot (quantile-binwidth)", p_quantile_binwidth),
229+
"The provided binwidth will cause dots to overflow the boundaries of the geometry.")
226230
})
227231

228232
test_that("ppc_ecdf_overlay renders correctly", {

0 commit comments

Comments
 (0)