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

From: Berwin A Turlach <berwin_at_maths.uwa.edu.au>
Date: Mon 13 Nov 2006 - 06:16:18 GMT

G' day Myung,

>>>>> "MGK" == mgkim <mgkim@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@maths.uwa.edu.au Australia http://www.maths.uwa.edu.au/~berwin

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon Nov 13 17:19:18 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 13 Nov 2006 - 08:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.