nclass.numpy {ppgmmga} | R Documentation |
Compute the Number of Classes for a Histogram
Description
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.
Usage
nclass.numpy(x, ...)
Arguments
x |
A vector of values. |
... |
Further arguments passed to or from other methods. |
Author(s)
Scrucca L. luca.scrucca@unipg.it
See Also
Examples
## 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)
[Package ppgmmga version 1.3 Index]