## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup, message=FALSE, warning=FALSE, echo=FALSE--------------------------
library(ggdibbler)

## ----eval = FALSE-------------------------------------------------------------
# geom_YOURGEOM_sample <- make_constructor(YOURGEOM, stat = "GGPLOT2STAT_sample",
#                                          times = 10, seed = NULL)

## ----eval = FALSE-------------------------------------------------------------
# #' @importFrom ggplot2 ggproto Stat***
# #' @format NULL
# #' @usage NULL
# #' @export
# Stat***Sample <- ggplot2::ggproto("Stat***Sample", ggplot2::Stat***,
#                                   ### INCLUDE SETUP PARAMS IF IN PARENT STAT
#                                   setup_params = function(self, data, params) {
#                                     # take one sample just to train the parameters
#                                     times <- params$times
#                                     params$times <- 1
#                                     data <- dibble_to_tibble(data, params)
#                                     params <- ggplot2::ggproto_parent(ggplot2::Stat***, self)$setup_params(data, params)
#                                     params$times <- times
#                                     params
#                                   }
#                                   ###  SETUP_DATA MUST BE IMPLEMENTED...
#                                   setup_data = function(data, params) {
#                                     dibble_to_tibble(data, params)
#                                     # BUT YOU ONLY NEED TO INCLUDE THIS LINE IF THE MAIN STAT USES SETUP DATA
#                                     ggproto_parent(Stat***, self)$setup_data(data, scales)
#                                     },
# 
#                                   extra_params = c("na.rm", "times", "seed")
# )
# 
# #' @export
# #' @inheritParams ggplot2::stat_***
# #' @param times A parameter used to control the number of values sampled from
# #' each distribution.
# #' @param seed Set the seed for the layers random draw, allows you to plot the
# #' same draw across multiple layers.
# stat_***_sample <- make_constructor(Stat***Sample, geom = "***",
#                                     times = 10, seed = NULL)
# 
# 
# 
# 

## ----include=FALSE, eval=FALSE------------------------------------------------
# library(spelling)
# qmd <- "D_extender-info.Rmd"
# check_spelling <- spell_check_files(
#   qmd,
#   lang = "en_GB"
# )
# if (nrow(check_spelling) > 0) {
#   print(check_spelling)
#   stop("Check spelling in Qmd files!")
# }

