0

I have a problem with the stem- and leaf-plot-function. One example: I want to stem the correlation coefficients of my meta-analysis. Here I have just 2 correlation coefficients (0,056 and -0,022). I tried the following function:

y<-c(0.056, -0.022)
stem(y)

and I get the following result:

   -2 | 2
   -0 | 
    0 | 
    2 | 
    4 | 6

but thats not the right result, it has to be:

    0 | 6
   -0 | 2 

So I don't understand which function I have to use to get the right result. I would be realy thankful if somebody could help me!

1
  • You can shrink the stem+leaf plot using the scale argument (e.g. scale = 0.2) but I don't think you're going to be able to reverse the direction of the vertical "axis". That looks like it's built in that way.
    – joran
    Jan 18, 2013 at 19:02

2 Answers 2

2

Check out help(stem) and change the scale parameter to control the length of stem plot:

R > stem(y, scale = 2)

  The decimal point is 2 digit(s) to the left of the |

  -2 | 2
  -1 | 
  -0 | 
   0 | 
   1 | 
   2 | 
   3 | 
   4 | 
   5 | 6

Does that make more sense?

3
  • Thank you for your reply, but it`s not excactly what I wanted. Jan 19, 2013 at 13:42
  • I read an articel about stem function in meta-analysis and in this articel the told: If I have the number 0.056, the stem-function takes the 0 (behind the point) and takes the 0 to the front of the symbol |. And the 5 will be rounded to a 6 because the 6 after the 5. And this rounded 6 will come after the symbole 0|. But if I use the stem-function in R, the function takes the 5 and put it before the symbole | and the number 6 it takes behind the symbole |. So, now I am confused which method is wright and which one is wrong!? Jan 19, 2013 at 13:47
  • I did not officially learn stem and plot function before, but I checked it out in this wiki. Both ways seem ok for me, but since -0.022 and 0.056 are in the same scale (two decimal), I get more information from 5|6 than from 0|6 plus this information The decimal point is 2 digit(s) to the left of the |. Since you can control the scale parameter in stem function, I think it depends on you to get what you need.
    – liuminzhao
    Jan 19, 2013 at 15:40
0

The closest I get to your output is:

stem(y, scale=0.5, atom=0.1)

But it has the negative at the top instead of the bottom.

The first one that you show is a correct answer (the 0.04 and 0.05 stems are grouped together) even if not the desired answer.

1
  • Consider the following stem and leaf plot representing (in cm) the daily growth of a plant in a green house (these are fictitious data). Tenths Hundredths 0.0 0, 1, 9 0.1 2, 2, 2, 5, 7 0.2 4 0.3 3, 3, 3, 3, 3 0.4 0.5 1, 2, 2, 2, 4, 8, 9, 9 0.6 6, 6, 8 0.7 1, 1, 4 0.8 2 From this graph of the data, we can read off the individual values of the original data set: 0.00, 0.01, 0.09, 0.12, 0.12, 0.12, 0.15, 0.17, 0.24, 0.33, 0.33, 0.33, 0.33, 0.33, 0.51, 0.52, 0.52, 0.52, 0.54, 0.58, 0.59, 0.59, 0.66, 0.66, 0.68, 0.71, 0.71, 0.74, 0.82. Jan 19, 2013 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.