R/gghist.R

Defines functions gghist

Documented in gghist

#' gghist
#'
#' @param x
#' @param bins
#' @param density
#' @param color
#'
#' @return
#' @export
#'
#' @examples
gghist = function(x,bins = 30,density=F,color = "grey95",...){
  df = data.frame(x)
  if(density){
    ggplot(df, aes(x=x),...) +
      geom_histogram(aes(y=..density..),color="black", fill=color,bins=bins)+
      geom_density()
  }else{
    ggplot(df, aes(x=x),...) +
      geom_histogram(color="black", fill=color,bins=bins)
  }

}
itsaquestion/MyPlot documentation built on July 22, 2019, 8:40 p.m.