Include any libraries that we are going to use

library(openintro)

Load the data

data(email50)
data(COL)

Make a histogram

d <- email50$num_char
hist(d)

Add an x label ‘Number of Characters (in thousands)’

hist(d,
        xlab=' ' #enter suitable x axis label between the quotes
        )

Make the bins too narrow

hist(d,
        xlab=' ', #enter suitable x axis label between the quotes
        breaks=50 #try other numbers here
        )

Make the bins too wide

hist(d,
        xlab=' ', #enter suitable x axis label between the quotes
        breaks=2 #try other numbers here
        )

Make the bins a good size

hist(d,
        xlab=' ', #enter suitable x axis label between the quotes
        breaks=20 #try other numbers here
        )

Colour the bins

hist(d,
        xlab=' ', #enter suitable x axis label between the quotes
        breaks=20,
        col= COL[1,2]
        )

Give the plot a title

hist(d,
        xlab=' ', #enter suitable x axis label between the quotes
        breaks=20,
        col= COL[1,2],
        main="My shiny histogram" # enter something suitable between the quotes
        )

Add a vertical line to show the mean of the data set

hist(d,
        xlab="", #enter suitable x axis label between the quotes
        breaks=20,
        col= COL[1,2],
        main="" # enter something suitable between the quotes
        )
abline(v=mean(d),col="red")

Add a vertical line to show the median of the data set

hist(d,
        xlab="", #enter suitable x axis label between the quotes
        breaks=20,
        col= COL[1,2],
        main="" # enter something suitable between the quotes
        )
abline(v=mean(d),col="red")
abline(v=median(d),col="blue")