[R] plot of Bernoulli data
Ben Bolker
ben at zoo.ufl.edu
Tue Oct 2 15:05:19 CEST 2001
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list