[R] Plotting two ecdf curves on same axes

Frank E Harrell Jr fharrell at virginia.edu
Tue Oct 15 21:21:43 CEST 2002


On Tue, 15 Oct 2002 17:30:17 +0200 (MEST)
Jane McFerren <jane.mcferren at lycos.co.uk> wrote:

> Dear R listers
> 
> Could somebody please advise me how to draw two empirical cumulative distribution 
> functions on the same set of axes?
> 
> I know I should be using the ecdf command but I'm not sure what to add to it to force it 
> to plot twice on the axes
> 
> Thanks
> Jane
> ______________________________________________________

One way is

library(Hmisc)
ecdf(~ y, groups=grouping.variable)

You can also produce multiple panels:

ecdf(~ y | state, groups=urban.vs.rural)

-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list