Exercise

# The hist() and truehist() functions

Histograms are probably the best-known way of looking at how the values of a numerical variable are distributed over their range, and R provides several different histogram implementations.

The purpose of this exercise is to introduce two of these:

`hist()`

is part of base R and its default option yields a histogram based on the number of times a record falls into each of the bins on which the histogram is based.`truehist()`

is from the`MASS`

package and scales these counts to give an estimate of the probability density.

Instructions

**100 XP**

- Use the
`par()`

function to set the`mfrow`

parameter for a side-by-side array of two plots. - Use the
`hist()`

function to generate a histogram of the`Horsepower`

variable from the`Cars93`

data frame. Set its`main`

argument equal to the title of the plot,`"hist() plot"`

. - Use the
`truehist()`

function to generate an alternative histogram of the same variable. Title this plot,`"truehist() plot"`

by specifying its`main`

argument accordingly.