# [R] stem() bug?

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 24 10:17:08 CEST 2004

```It is as intended.  The answer is correct but your interpretation of it is
not, and the help page is woefully lacking.

Note that the bins in your problem are [20, 40), [40, 60), [60, 80) and
[80, 100) and they are correctly labelled.  In such bins e.g. 20 and 30
are both represented in the same way.

Does stem(seq(30, 92, 5)) help you see the pattern?

Please would one of those bemoaning R's documentation recently submit to
R-bugs an enhanced help page for stem?

On Tue, 24 Aug 2004, Ramzi Nahhas wrote:

>
> Is the following a bug with stem() or is there something else that I am
> missing? I ran stem() on the vector x below and got stem(x-10) instead of
> stem(x). If I subtract 1 from x, I get a correct answer. If I add 1 to x, I
> still get a wrong answer. If I add 10 to x, I get a correct answer. I'm not
> sure what to make of this, other than to think it is a bug.
>
> Can anyone tell me if this is a bug?
>
> I am running R 1.9.1 on Windows XP (SP2).
>
> Sincerely,
> 	Ramzi Nahhas
>
> PS In your reply, please copy me at Ramzi_Nahhas at sil.org as I am not
> subscribed to this list. Thank you.
>
> > x
>  [1] 30 70 90 75 70 95 75 70 60 55
> > stem(x)
>
>   The decimal point is 1 digit(s) to the right of the |
>
>   2 | 0
>   4 | 5
>   6 | 000055
>   8 | 05
>
> > stem(x-1)
>
>   The decimal point is 1 digit(s) to the right of the |
>
>   2 | 9
>   4 | 49
>   6 | 99944
>   8 | 94
>
> > stem(x+1)
>
>   The decimal point is 1 digit(s) to the right of the |
>
>   2 | 1
>   4 | 6
>   6 | 111166
>   8 | 16
>
> > stem(x+10)
>
>   The decimal point is 1 digit(s) to the right of the |
>
>    4 | 0
>    6 | 50
>    8 | 00055
>   10 | 05
>
> ---
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

```