[R] Bug on the stem function or in my brain ?

Ignacio Colonna iacolonn at uiuc.edu
Mon Mar 21 17:41:45 CET 2005


José,
	Notice that the values to the left of the | in your stem plot are
all even. Odd numbers are included in the same line.

Try
> stem(time,scale=2)

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

   3 | 2
   4 | 17
   5 | 09
   6 | 4667789
   7 | 38
   8 | 3
   9 | 0335
  10 | 00
  11 | 0


ignacio

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jose A. Hernandez
Sent: Monday, March 21, 2005 9:15 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Bug on the stem function or in my brain ?

Good day R-ers!

I was running the basic statistics for the exam that my students took 
last week and something does not make sense with the stem() fucntion.

Here are two of my variables:

time, is time to complete the exam in minutes
exam.1, is the grade for the exam

In stem(), to the left of the vertical bar are the leading digits of the 
grades. To the right of the vertical bar are the last digits of the 
grades. Each single digit on the right represents one grade.

 > time
  [1]  32  41  47  50  59  64  66  66  67  67  68  69  73  78  83  90 
93  93  95
[20] 100 100 110
 > stem(time)

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

    2 | 2
    4 | 1709
    6 | 466778938
    8 | 30335
   10 | 000

The stem and leaf plot does not reflect the actual data, the bottom line 
for instance says there were 3 people that spent 100 minutes working on 
the test. The next to bottom line says there were one 80, three 83s, one 
85. And so forth.

 > exam.1
  [1]  82 100  86  81  88  78  92  23  91  49  97   9  89  78  93  60 
80  80  83
[20]  94  51 100

 > stem(exam.1)

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

    0 | 9
    2 | 3
    4 | 91
    6 | 088
    8 | 0012368912347
   10 | 00

The Stem-and-Leaf plots DO NOT correspond to the data.

Any educational insights on this issue would be appreciated.

Regards,

Jose

 > class(exam.1)
[1] "numeric"
 > class(time)
[1] "numeric"

 > version
          _
platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    2
minor    0.1
year     2004
month    11
day      15
language R


-- 
Jose A. Hernandez
Ph.D. Candidate
Precision Agriculture Center

Department of Soil, Water, and Climate
University of Minnesota
1991 Upper Buford Circle
St. Paul, MN 55108

Ph. (612) 625-0445, Fax. (612) 625-2208

______________________________________________
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




More information about the R-help mailing list