Code Studio: Histogram Bins
Practise the histogram ideas from Introduction to Histograms on the faithful dataset: eruption lengths of the Old Faithful geyser.
The program reads a suggested number of bins.
- Draw a histogram of
faithful$eruptionswithhist(), passing the number asbreaks, with a title and axis label. hist()also returns what it drew. Print how many bins it actually used, and the count in the tallest bin:
For a suggestion of 10:
Bins: 8 Tallest bin: 75
Hint: h <- hist(...), then length(h$counts) and max(h$counts).
Try 5, 10 and 30 bins. Why does R not always use exactly the number you ask for? And what does the shape tell you about eruptions?
Run draws your plot under the output. Check and Submit test the numbers your program prints.
Practise the histogram ideas from Introduction to Histograms on the faithful dataset: eruption lengths of the Old Faithful geyser.
The program reads a suggested number of bins.
- Draw a histogram of
faithful$eruptionswithhist(), passing the number asbreaks, with a title and axis label. hist()also returns what it drew. Print how many bins it actually used, and the count in the tallest bin:
For a suggestion of 10:
Bins: 8 Tallest bin: 75
Hint: h <- hist(...), then length(h$counts) and max(h$counts).
Try 5, 10 and 30 bins. Why does R not always use exactly the number you ask for? And what does the shape tell you about eruptions?
Run draws your plot under the output. Check and Submit test the numbers your program prints.