Selon Lisa Wang <[EMAIL PROTECTED]>:

> Hello there,
>
> I am using R to plot some cumulative histogram for my data. Please help
> in this case.
>
> Thank you
>
> Lisa Wang

Hi Lisa,

Here is one way (if i am right in what is a cumulative histogram), using the
existing possibilities

cumhist <- function(x, plot=TRUE, ...){
  h <- hist(x, plot=FALSE, ...)
  h$counts <- cumsum(h$counts)
  h$density <- cumsum(h$density)
  h$itensities <- cumsum(h$itensities)

  if(plot)
    plot(h)
  h
}


R> x <- rnorm(100)
R> cumhist(x)
R> # hist(x, add=TRUE, col="cyan")
R> # if you want to overlay the original histogram

-- Romain

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to