You might look at the 'mdlp' function in the 'discretization' package. (SPSS has a procedure called 'optimal binning' that uses the 'minimum description length principle' to do the binning.)
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Santosh > Sent: Tuesday, November 27, 2012 11:59 AM > To: r-help > Subject: Re: [R] binning by frequency > > Thanks for your response. > Was wondering if there are any R functions/packages to perform optimal > binning of continuous data. > > Thanks, again. > Santosh. > > On Tue, Nov 27, 2012 at 9:09 AM, Mark Lamias <mlam...@yahoo.com> wrote: > > > You might find the binning function in the sm package helpful here. > > > > --Mark Lamias > > > > ------------------------------ > > *From:* Santosh <santosh2...@gmail.com> > > *To:* r-help <r-help@r-project.org> > > *Sent:* Tuesday, November 27, 2012 9:59 AM > > *Subject:* [R] binning by frequency > > > > Dear Rxperts, > > > > is there way to identify intervals from continuous data (having some kind > > of a pattern) and then pick the value of most frequency? > > > > > > a1 <- round(rnorm(50,mean=0,0.1),2) > > a2 <- round(rnorm(50,mean=1,0.2),1) > > a3 <- round(rnorm(50,mean=5,1),0) > > a4 <- round(rnorm(50,mean=14,4),0) > > a5 <- round(rnorm(50,mean=30,8),0) > > > > b1 <- rbind(a1,a2,a3,a4,a5) > > > > hist(b1,brea=100) # shows intervals and values with varying frequency. > > > > unlike the mean values of a1.... a5 above, I don't know the nominal values. > > I would like an algorithm to identify intervals and pick the value with > > most frequency. > > > > I tried "cut", "split" and was not successful. > > Any suggestions/tips are highly welcome. > > Thanks and regards, > > Santosh > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.