Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.30.0110020904580.30607-100000@bolker.zoo.ufl.edu>
Date: 2001-10-02T13:05:19Z
From: Ben Bolker
Subject: plot of Bernoulli data
In-Reply-To: <Pine.LNX.4.10.10110021252580.983-100000@localhost.localdomain>

cut()?

On Tue, 2 Oct 2001, Bill Simpson wrote:

> >  x<-sort(runif(100,1,20))
> >  p<-pnorm(x,10,3)
> >  y<-as.numeric(runif(x)<p)
> >  plot(x,y)
> >  lines(x,p)
> df<-data.frame(x,y)
> aggregate(df,list(x=(x<5),(x>5)&(x<10),(x>10) & (x<15),(x>15)), FUN=mean)
> gives me what I want but if anyone has a better way to collect the
> observations into bins I'd like to hear it. It would be nice to
> pass along something like
> breaks<-c(5,10,15,20)
>
> Thanks
>
> Bill Simpson
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._