An R Introduction to Statistics

Stem-and-Leaf Plot

A stem-and-leaf plot of a quantitative variable is a textual graph that classifies data items according to their most significant numeric digits. In addition, we often merge each alternating row with its next row in order to simplify the graph for readability.

Example

In the data set faithful, a stem-and-leaf plot of the eruptions variable identifies durations with the same two most significant digits, and queue them up in rows.

Problem

Find the stem-and-leaf plot of the eruption durations in faithful.

Solution

We apply the stem function to compute the stem-and-leaf plot of eruptions.

Answer

The stem-and-leaf plot of the eruption durations is

> duration = faithful$eruptions 
> stem(duration) 
 
  The decimal point is 1 digit(s) to the left of the | 
 
  16 | 070355555588 
  18 | 000022233333335577777777888822335777888 
  20 | 00002223378800035778 
  22 | 0002335578023578 
  24 | 00228 
  26 | 23 
  28 | 080 
  30 | 7 
  32 | 2337 
  34 | 250077 
  36 | 0000823577 
  38 | 2333335582225577 
  40 | 0000003357788888002233555577778 
  42 | 03335555778800233333555577778 
  44 | 02222335557780000000023333357778888 
  46 | 0000233357700000023578 
  48 | 00000022335800333 
  50 | 0370

Exercise

Find the stem-and-leaf plot of the eruption waiting periods in faithful.