R/hello.R

Defines functions stat

Documented in stat

#' Creates Histogram, Box plot and Numerical Summary
#' @export
#' @param  x numeric variable
stat <-  function(x){
  #1 row and 2 columns
  par(mfrow = c(1,2))
  # Histogram
  hist(x, col = rainbow(30))
  #Box plot
  boxplot(x, col = "red")
  # 1 row and 1 column
  par(mfrow = c(1,1))
  # Numerical calculation
  data.frame(mean = mean(x),
             median = median(x),
             min = min(x),
             max = max(x),
            variance = var(x),
            sd = sd(x))
}
Chetan265/stat documentation built on Dec. 17, 2021, 2 p.m.