[R] using the stepfun to plot histogram outline.

Karin Lagesen karinlag at studmed.uio.no
Sat Jun 21 10:36:36 CEST 2008


Hello list:)

I have lots of values which I would like to get a histogram outline
out of.

An example of what I am talking about:

testdata = runif(100)
bbb = seq(0,1, by = 0.01)
hist(testdata, breaks = bbb)

I would like to get the outline of the resulting histogram.

Now, I think that I can do this using the stepfun function. However, I
am uncertain of how to get to the data the stepfun function require.

>From ?stepfun

Arguments:

       x: numeric vector giving the knots or jump locations of the step
          function for 'stepfun()'.  For the other functions, 'x' is as
          'object' below.

       y: numeric vector one longer than 'x', giving the heights of the
          function values _between_ the x values.


X I think is the same as bbb above. I am however uncertain of how I
would go about getting the data needed for y, given that the data I
have is on the same format as testdata above is.

Thanks for your help!

Karin
-- 
Karin Lagesen, PhD student
karin.lagesen at medisin.uio.no
http://folk.uio.no/karinlag



More information about the R-help mailing list