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

Jose A. Hernandez jahernan at umn.edu
Mon Mar 21 16:15:17 CET 2005


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




More information about the R-help mailing list