Graphics Programs Reference
In-Depth Information
FIGurE 6-21 Stem-and-leaf plot showing worldwide birth rates
Here's how you would draw this by hand. Write numbers 8 to 52 in inter-
vals of 2, top to bottom. Draw a line to the right of the column of numbers.
Then go down each row of your data and add numbers accordingly. If a
country has a birth rate of 8.2, you add a 2 to the right of the 8. If there is a
country with a rate of 9.9, it also goes in the row with an 8. You write a 9.
This can obviously get tedious if you have a lot of data, so here's how to
make a stemplot in R. After you load your data, simply use the stem()
function.
birth <- read.csv(“http://datasets.flowingdata.com/birth-rate.csv”)
stem(birth$X2008)
That's all there is to it. If you want to style it, as shown in Figure 6-22, you
can copy the text in R, and paste it elsewhere—but this method is outdated
and probably better off with a histogram. The histogram is basically the
more graphical version of the stem-and-leaf.
Search WWH ::




Custom Search