add_norm: Add normal curve to histogram

View source: R/s216-applets.R

add_normR Documentation

Add normal curve to histogram

Description

This function will add a normal curve to a frequency or density histogram using the raw data and histogram object as arguments.

Usage

add_norm(
  h,
  data,
  freq = TRUE,
  na.rm = FALSE,
  lty = 1,
  lwd = 2,
  col = "purple",
  ...
)

Arguments

h

Histogram object generated by hist.

data

Vector of values used to generate the histogram.

freq

Logical value indicating whether y-axis of histogram is frequency. Defaults to TRUE.

na.rm

Logical value indicating whether NA values should be stripped before the computation proceeds. Defaults to TRUE.

...

Other graphical parameters.

Examples

x <- rnorm(30, 5, 2)
hi <- hist(x)
add_norm(h = hi, data = x)

greenwood-stat/catstats documentation built on Dec. 14, 2024, 6:25 p.m.