[R] construct stem and leaf plot
Sarah Goslee
sarah.goslee at gmail.com
Fri Jul 19 15:24:07 CEST 2013
Hi,
On Fri, Jul 19, 2013 at 2:15 AM, Roslina Zakaria <zroslina at yahoo.com> wrote:
> Dear r-users,
>
> I would like to construct tem and leaf plot using iris data. It should be easy, but I don't understand why the plot is not right.
>
> Thank you so much for your help.
>
> dat <- iris[,1] > stem(dat) The decimal point is 1 digit(s) to the left of the | 42 | 0 44 | 0000 46 | 000000 48 | 00000000000 50 | 0000000000000000000 52 | 00000 54 | 0000000000000 56 | 00000000000000 58 | 0000000000 60 | 000000000000 62 | 0000000000000 64 | 000000000000 66 | 0000000000 68 | 0000000 70 | 00 72 | 0000 74 | 0 76 | 00000 78 | 0
> [[alternative HTML version deleted]]
I can't really tell, because you posted in HTML, but that looks like
it was once a perfectly reasonable stem and leaf plot.
It's filled with zeros because the R function puts two digits as the
stem, and the third digit as the leaves, and for the iris data the
third digit is always zero. Compare:
data(faithful)
stem(faithful$eruptions)
Other than that, you'll have to tell us what you think the result should be.
Sarah
--
Sarah Goslee
http://www.functionaldiversity.org
More information about the R-help
mailing list