R/reveal.R

Defines functions reveal

Documented in reveal

#' @title Reveal the true data's position in a diagnostic parade
#'
#' @description This function reveals the position of the true data in a parade.
#'
#' @param parade The name of an object generated using the \code{\link{parade}}
#' or \code{\link{parade_summary}} function.
#' @export
#' @examples
#' # Fit model
#' m <- lm(mpg ~ disp, data = mtcars)
#'
#' # Generate parade
#' my_parade <- parade(m)
#'
#' # Linearity check
#' lin_plot(my_parade)
#'
#' # Reveal
#' reveal(my_parade)

reveal <- function(parade) {

  if (is.null(attr(parade, "position"))) {
    stop("The object you supplied doesn't seem to be a parade generated by the parade() function.")
  }

  message(paste0("The true data are in position ", attr(parade, "position"), "."))
}
janhove/cannonball documentation built on Feb. 19, 2025, 5:13 a.m.