[R] Parallel stem-and-leaf displays

David Winsemius dwinsemius at comcast.net
Sun Sep 14 01:05:15 CEST 2008


On Sep 13, 2008, at 4:21 PM, Celia Chen wrote:

> Thank you Jim.
>
> Here I creat an example: A<-c(1.1,1.2,2.2,1.3, 1.5, 2.5)
>                                     B<-c(2.2,2.3,2.4,2.2, 2.0,1.9,  
> 2.5)
> I will need to draw the parallel stem-and-leaf displays to show the
> difference in trend/pattern between the two data patches.
>
> And I think parellel stem-and-leaf displays by Tukey means that the  
> two
> displays share the same stem, but different leaves. And I don't  
> think there
> is an R command for this.
>
> In addition, I am confused by another problem in stem-and-leaf  
> display that
> is done by R.
>
> Here it is :
> Y<-c(12,15,15,10,13,15,14,8,11,9,14,9,13,14,12,16,15,13,12,12,9)
>                  y<-Y/100
>                  stem.leaf(y,0.01)
> 1 | 2: represents 0.12
> leaf unit: 0.01
>         n: 21
>   1     s | 7
>   4    0. | 999
> 10    1* | 002222
>   (3)    t | 333
>    8     f | 44444445
>
>
> This result is quite confusing, cos the smallest leaf should be "8"  
> rather
> than "7", plus there is non "7" in the dataset. And more over, there  
> is no
> "16" shown in the last line of leaves.
>
> If anyone knows what's going on here, please let me know. Thank you!

This function in a non-core package, aplpack, so it is not R that is  
"doing" this, but that particular function. If you don't want to look  
through the code yourself, you could contact the package maintainer,  
which the help pages say is:

Author(s)
Peter Wolf Maintainer: Peter Wolf <pwolf at wiwi.uni-bielefeld.de>



A possible hint to what might be happening is that stem.leaf(y, 0.001)  
produces results are probably more to your liking:

 > stem.leaf(y, 0.001)

1 | 2: represents 0.012

  leaf unit: 0.001

             n: 21

    1     8 | 0

    4     9 | 000

    5    10 | 0

    6    11 | 0

   10    12 | 0000

   (3)   13 | 000

    8    14 | 000

    5    15 | 0000

    1    16 | 0



-- 

David Winsemius, MD

Heritage Laboratories



More information about the R-help mailing list