R: Stem-and-Leaf Plots
Code Only
|
Code with Rweb Output
|
### Lets work with the pre-installed cars data set found in R
cars; attach(cars) ### default stem, doesn't represent data so well stem(dist) ### The parameter scale can be used to expand the scale of the plot. ### A value of scale=2 will cause the plot to be roughly twice ### as long as the default. stem(dist, scale=2) ### experiment with a scale of 4 stem(dist, scale=4) |
> ### Lets work with the pre-installed cars data set found in R
> cars; attach(cars) speed dist 1 4 2 2 4 10 3 7 4 ... 48 24 93 49 24 120 50 25 85 > > ### default stem, doesn't represent data so well > stem(dist) The decimal point is 1 digit(s) to the right of the | 0 | 24004678 2 | 002466668822244466 4 | 002668024466 6 | 046806 8 | 04523 10 | 12 | 0 > > ### The parameter scale can be used to expand the scale of the plot. A value of ### scale=2 will cause the plot to be roughly twice as long as the default. > stem(dist, scale=2) The decimal point is 1 digit(s) to the right of the | 0 | 24 1 | 004678 2 | 0024666688 3 | 22244466 4 | 002668 5 | 024466 6 | 0468 7 | 06 8 | 045 9 | 23 10 | 11 | 12 | 0 > > ### Experiment with a scale of 4 > stem(dist, scale=4) The decimal point is 1 digit(s) to the right of the | 0 | 24 0 | 1 | 004 1 | 678 2 | 0024 2 | 666688 3 | 222444 3 | 66 4 | 002 4 | 668 5 | 0244 5 | 66 6 | 04 6 | 68 7 | 0 7 | 6 8 | 04 8 | 5 9 | 23 9 | 10 | 10 | 11 | 11 | 12 | 0 |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.