R/histogram_with_kernel.r

Defines functions histogram_with_kernel

  histogram_with_kernel = function(x, s0, s1, bwh, bwd, title, ...) {
    breaks = seq(s0, s1, bwh)
    out = hist(x, breaks=breaks, main=title, ...)
    k = density(x, bw=bwd)
    k$y = k$y * (k$n) * bwh
    lines(k, lwd=2)
    return(out)
  }
jae0/snowcrab documentation built on Nov. 6, 2024, 10:13 p.m.