Chapter 6. Stem-and-Leaf Plots
Basic Stem-and-Leaf Plot
This short chapter might be considered “nostalgia” by some because it describes a type of graph that was important in the paper-and-pencil days of data analysis. You probably will not see many examples of this type of graph in modern presentations, but it is included here because it will help you to understand the histogram a little better, which is the topic of Chapter 7. You might also find it useful in the exploratory phase of your data examination. If you are already knowledgeable about histograms, you can skip this chapter without fear of missing necessary material.
The sbp
dataset in the multcomp
package includes the variables sbp
—the systolic blood pressure of 69 patients—and the gender
of each of those people as well as the age of each. We can look at the distribution of the blood pressures with a stem-and-leaf plot. This type of graph reveals not only the general shape of the data distribution, but the (rounded) value of each data point as well.
The stem-and-leaf plot works by putting all of the values in order, from lowest to highest. Then, it reserves a line for all of the values in a common range and writes the last significant digit of each number on the appropriate line. You can use the stem()
command in base R to create a stem-and-leaf plot of the sbp
variable in the sbp
dataset. This type of display, sometimes called a textual display, appears in the R console, not in a graphic window. We can produce ...
Get Graphing Data with R now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.