[R] using the stepfun to plot histogram outline.

From: Karin Lagesen <karinlag_at_studmed.uio.no>
Date: Sat, 21 Jun 2008 10:36:36 +0200

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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 21 Jun 2008 - 15:14:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 21 Jun 2008 - 16:30:48 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive