[R] Cumulative lattice histograms
Dieter Menne
dieter.menne at menne-biomed.de
Mon May 12 11:36:20 CEST 2008
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
More information about the R-help
mailing list