Stem and Leaf Display
DESCRIPTION:
Prints a stem-and-leaf display for the given data.
The form of the display can be produced automatically, or be
controlled by the user.
USAGE:
stem(x, nl=<<see below>>, scale=<<see below>>, twodig=F,
fence=2, head=T, depth=F)
REQUIRED ARGUMENTS:
- x
-
numeric vector to be displayed. Missing values (
NAs) are
allowed.
OPTIONAL ARGUMENTS:
- nl
-
number of different leaf values on a stem. Allowed values
are
2,
5,
10. The default is to determine an appropriate value
automatically.
- scale
-
position at which the break occurs between the stem and the leaves,
counting to the right from the decimal point; e.g.,
-1 would
break between the tens and the units digit. By default, a
suitable position is chosen from the range of the data.
- twodig
-
logical flag: if
TRUE, two digits are printed for each observation.
- fence
-
the multiple of the inter-quartile range used to determine
outliers. By default, any point further than 2
inter-quartile ranges from the nearest quartile is considered an
outlier, and is printed separately from the body of the stem-and-leaf display.
If the inter-quartile range is zero, the algorithm performs outlier
detection by means of quartiles of the remainder of the data
after exclusion of values equal to the median and quartiles.
- head
-
if
TRUE, print a heading giving median,
quartiles, and counts of data values and
NAs.
- depth
-
if
TRUE, precede each line with depth and count.
The count is the number of data values on a line.
The depth is the cumulative sum of the counts to the nearer extreme.
.ne 20
SIDE EFFECTS:
a stem and leaf display of
x is printed.
Stem and leaf displays are very similar to histograms, but retain
more information, and are very easy to produce by hand.
DETAILS:
The number of missing values is stated in the printout if
head is
TRUE
.
A number that is precisely zero is identified by
z (or
zz if
twodig
is
TRUE).
An error occurs if there is only one unique value in the data.
REFERENCES:
Hoaglin, D. C., Mosteller, F. and Tukey, J. W., editors (1983).
Understanding Robust and Exploratory Data Analysis.
Wiley, New York.
Mosteller, F. and Tukey, J. W. (1977).
Data Analysis and Regression.
Addison-Wesley, Reading, Mass.
Velleman, P. F. and Hoaglin, D. C. (1981).
Applications, Basics, and Computing of Exploratory Data Analysis.
Duxbury, Boston.
SEE ALSO:
hist
,
boxplot
.
EXAMPLES:
stem(lottery.payoff)
N = 254 Median = 270.25
Quartiles = 194, 365
Decimal point is 2 places to the right of the colon
0 : 8
1 : 000011122233333333333344444
1 : 55555566666677777778888888899999999999
2 : 0000000111111111111222222233333333444444444
2 : 555556666666666777778889999999999999999
3 : 000000001111112222333333333444
3 : 55555555666667777777888888899999999
4 : 0122234
4 : 55555678888889
5 : 111111134
5 : 555667
6 : 44
6 : 7
High: 756.0 869.5