Message-ID: <Pine.LNX.4.10.10110021252580.983-100000@localhost.localdomain>
Date: 2001-10-02T11:57:18Z
From: Bill Simpson
Subject: plot of Bernoulli data
In-Reply-To: <Pine.LNX.4.10.10110021008370.522-100000@localhost.localdomain>
> 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._