Skip to Main Content
Graphing Data with R
book

Graphing Data with R

by John Jay Hilfiger
October 2015
Beginner to intermediate content levelBeginner to intermediate
250 pages
6h 26m
English
O'Reilly Media, Inc.
Content preview from Graphing Data with R

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

A Course in Statistics with R

A Course in Statistics with R

Prabhanjan N. Tattar, Suresh Ramaiah, B. G. Manjunath

Publisher Resources

ISBN: 9781491922606Errata Page