Learn R Programming

mStats (version 3.4.0)

histogram: Histograms with overlay normal curve

Description

histogram() draws a histogram with formatted texts and adds a normal curve over the histogram.

Usage

histogram(
  data,
  var,
  breaks = NULL,
  xlab = NULL,
  main = NULL,
  sub = NULL,
  labels = TRUE,
  freq = TRUE,
  curve = TRUE,
  ...
)

Arguments

data

Dataset

var

variable

breaks
xlab
main
sub
labels
freq
curve

logical. If TRUE (default), a normal curve is overlaid over the histogram.

...

Details

If freq is set to FALSE, probability densities, component density, are plotted (so that the histogram has a total area of one). In this case, normal curve will not be generated.

Examples

Run this code
# NOT RUN {
# histogram(infert, age)
# histogram(infert, age, labels = FALSE)
# histogram(infert, age, freq = FALSE)

# }

Run the code above in your browser using DataLab