[R] histogram

Adaikalavan Ramasamy a.ramasamy at imperial.ac.uk
Mon Sep 15 00:32:09 CEST 2008


If I understand you correctly, you already pre-computed the frequencies 
and bin widths and want to display them as a histogram. If correct, then 
what you are asking for is analogous to what bxp() is to boxplot. I am 
not sure if such a function exists.

Instead you can think of the task as drawing a bunch of rectangles 
(perhaps using symbols?). Or you can hack the hist() code and try

    br    <- c(0,20,30,40,50,60,70,80,100)
    dens  <- runif( length(br) - 1 )

    r <- structure(list(breaks = br, density = dens),
                   class = "histogram")

    plot(r, main="Felipe's Histogram")

However, I do emphasize that this is a hack. If you have the original 
data that you used to calculate the densities, consider using the breaks 
argument with hist(). It is better to use tried and tested codes.

Regards, Adai



Felipe wrote:
> i calculated the density and wanna do something like this
> 
> separate in 0-19-29-39-49-59-69-79-99
> and put in these spaces 8 densities .. 0.something
> i have the frequency in % and divided already in 20 or 10 to get the density
> 
> i tried and tried..made breaks vector to separate but couldn't put the other
> vector with the frequency density onit directly
> 
> anyone know how to do it??
> 
> tks
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.



More information about the R-help mailing list