Theory, Examples & Exercises
This is an old revision of the document!
Author: Tim from CrossValidated, with modification from D. Zeleny
Quick and dirty function which draws histogram overlaid with normal distribution curve.
To modify color and thickness of the normal distribution curve, use arguments
lines.lwd. Function accepts most other arguments for
hist, with some limitations.
Example of use (using environmental data from the dataset Vegetation of Carpathian wetlands):
source ('http://www.davidzeleny.net/anadat-r/doku.php/en:customized_functions:hist.dnorm?do=export_code&codeblock=0') # reads the function definition from above chem <- read.delim ('http://www.davidzeleny.net/anadat-r/data-download/chemistry.txt', row.names = 1) # reads the ''chem'' dataset hist.dnorm (chem[,-15], cex.labels = 1)
Note that the package
car contains the function
scatterplotMatrix, which is doing something similar (and perhaps could be also further customized).