[R] using the stepfun to plot histogram outline.

hadley wickham h.wickham at gmail.com
Sat Jun 21 17:21:01 CEST 2008


On Sat, Jun 21, 2008 at 3:36 AM, Karin Lagesen <karinlag at studmed.uio.no> wrote:
>
> 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.

Do you want to draw the outline, or create a function that represents
it? (that's what stepfun will do)  Either way looking at:

h <- hist(testdata, breaks = bbb)
str(h)

will probably be helpful.

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list