[Rd] "stem" does not give a correct answer (PR#9359)

Berwin A Turlach berwin at maths.uwa.edu.au
Mon Nov 13 07:16:18 CET 2006


G' day Myung,

>>>>> "MGK" == mgkim  <mgkim at seowon.ac.kr> writes:

    MGK> For the data c1 of size 14, stem provides the following result.

    MGK> **************************************************************
    >> c1
    MGK> [1] 14 39 70 11 38 20 37 15 41 74 74 34 48 51
    ZZangi> stem(c1)

    MGK> The decimal point is 1 digit(s) to the right of the |

    MGK> 0 | 145
    MGK> 2 | 04789
    MGK> 4 | 181
    MGK> 6 | 044

    MGK> **************************************************************
    MGK> However, stem does not give a correct answer, for example 34, 74, etc.

No bug, it is just the scale to which stem decides to plot by
default.  The line 

        4 | 181

should give a clue that this summarises 41, 48 and 51.  Since the data
is so sparse only even leading numbers are used.  Try:

> dat <- c(14, 39, 70, 11, 38, 20, 37, 15, 41, 74, 74, 34, 48, 51)
> stem(dat)

  The decimal point is 1 digit(s) to the right of the |

  0 | 145
  2 | 04789
  4 | 181
  6 | 044

> stem(dat, scale=2)

  The decimal point is 1 digit(s) to the right of the |

  1 | 145
  2 | 0
  3 | 4789
  4 | 18
  5 | 1
  6 | 
  7 | 044

Cheers,

        Berwin

========================== Full address ============================
Berwin A Turlach                      Tel.: +61 (8) 6488 3338 (secr)   
School of Mathematics and Statistics        +61 (8) 6488 3383 (self)      
The University of Western Australia   FAX : +61 (8) 6488 1028
35 Stirling Highway                   
Crawley WA 6009                e-mail: berwin at maths.uwa.edu.au
Australia                        http://www.maths.uwa.edu.au/~berwin



More information about the R-devel mailing list