nclass.numpy | R Documentation |
Compute the number of classes for a histogram as the maximum of the "Sturges" and "FD" (Freedman Diaconis) estimators as in numpy library for Python.
nclass.numpy(x, ...)
x |
A vector of values. |
... |
Further arguments passed to or from other methods. |
Scrucca L. luca.scrucca@unipg.it
nclass.Sturges
, nclass.FD
## Not run:
library(ggplot2)
x <- rnorm(100)
ggplot() + geom_histogram(aes(x), col = "grey92", bins = nclass.numpy(x))
x <- rnorm(1000)
ggplot() + geom_histogram(aes(x), col = "grey92", bins = nclass.numpy(x))
n = c(50, seq(100,1000,by=100))
brks = rep(NA, length(n))
for(i in seq(n)) brks[i] = nclass.numpy(rnorm(n[i]))
ggplot() + geom_point(aes(x = n, y = brks))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.