Hi, you possibly know that there are a lot of methods to determine the number of bins. As a default R has the Sturges method. I think it does something like
x <- runif(100) mybreaks <- hist(runif(x))$breaks r <- max(x)-min(x) br <- nclass.Sturges(x) #note this is a really simple approach and see edit(nclass.Sturges) brn <- 0:br pretty(min(x)+brn*r/br, n=br) I tried to make the steps clear, the pretty function does the job in the end. Hope that helps (although I do not know if it is faster, but you can try it on your own), best daniel ________________________________________ Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmazó: Jonathan Greenberg [j...@illinois.edu] Küldve: 2014. március 22. 17:15 To: r-help Tárgy: [R] Determine breaks based on a break type... R-helpers: I was wondering, given a vector of data, if there is a way to calculate the break points based on the breaks= parameter from histogram, but skipping all the other calculations (all I want is the breakpoints, not the frequencies). I can, of course, simply run the histogram and extract the break component: mybreaks <- hist(runif(100))$breaks But is there a faster way to do this, if this is all I want? --j -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 ______________________________________________ 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.