Previous: Descriptive Plots: Box-plots | Up: Examples | Next: Advanced Examples |
Histograms are easy ways to evaluate the density of a quantity of interest.
Here's the code to create this graph:
> library(Zelig) # Loads the Zelig package. > data(turnout) # Loads the sample data set. > truehist(turnout$income, col = "wheat1", # Calls the main plot, with + xlab = "Annual Income in $10,000s", # options. + main = "Histogram of Income") > lines(density(turnout$income)) # Adds the kernel density line.