R/men_bin.R

Defines functions men_bin

Documented in men_bin

#' men_bin
#'
#' Visualization of the probability mass and the cumulative distribution function of
#' a binomial distribution.
#'
#' @param size integer: number of trials (zero or more)
#' @param prob numeric: probability of success on each trial
#'
#' @return nothing
#' @import shiny
#' @import shinydashboardPlus
#' @importFrom shinydashboard sidebarMenu menuItem dashboardBody
#' @export
#'
#' @examples
#' if (interactive()) men_bin()
#' if (interactive()) men_bin(20, 0.25)
men_bin <- function(size = 10, prob = 0.5) {
  oldpar <- graphics::par(no.readonly = TRUE)
  on.exit(resetpar(oldpar))
  pkgs <- checkPackages()
  if (!all(pkgs)) stop(sprintf("Please call first:\n install.packages(c(%s))", paste0("'", names(pkgs)[!pkgs], "'", collapse=", ")))
  shinyOptions(mmstat=list(distrd='BINOM', size=size, prob=prob))
  source(system.file("app", "men_ddist", "app.R", package = "HKRbook"), local = TRUE, chdir = TRUE)$value
}

Try the HKRbook package in your browser

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

HKRbook documentation built on Oct. 6, 2022, 9:06 a.m.