R/range-prob.R

Defines functions prob_range

# #' @title prob_range
# #' @description proto object for probability range
#' @importFrom ggplot2 ggproto
prob_range <- function() {
  ggplot2::ggproto(NULL, RangeProb)
}

RangeProb <- ggplot2::ggproto(NULL, NULL,
  range = NULL,
  levels = NULL,
  reset = function(self) {
    self$range <- NULL
    self$levels <- NULL
  },
  train = function(self, x, ...) {
    self$range <- scales::train_continuous(x[[1]], self$range)
    self$probs <- unique(c(x[[1]][!is.na(x[[1]])], self$range))
  }
)

Try the gghdr package in your browser

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

gghdr documentation built on Oct. 29, 2022, 1:16 a.m.