Re: [R] Cumulative lattice histograms

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Mon, 12 May 2008 09:36:20 +0000 (UTC)

Ola Caster <ola.caster <at> gmail.com> writes:

> It's fairly straightforward to plot cumulative histograms using the hist()
> function. You do something like:
>
> h <- hist(rnorm(100), plot=FALSE)
> h$counts<- cumsum(h$counts)
> plot(h)
>
> However, I have failed to find any example where this is done using the
> lattice histogram() function.

This is not a full solution to your problem with the red line, but at least comes close (hope so) to your original hist with lattic

library(lattice)
h = sort(rnorm(100),decreasing=TRUE)
df = data.frame(h=h,cum=cumsum(h))
histogram(h~cum,data=df)

Dieter



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 Mon 12 May 2008 - 09:40:45 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 Mon 12 May 2008 - 10:30:41 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