Histogram with exact number of bins specified by the user
The generic function histsu computes a histogram of the given data values.
histsu(x, breaks = "Sturges", freq = NULL, probability = !freq, include.lowest = TRUE, right = TRUE, density = NULL, angle = 45, col = NULL, border = NULL, main = paste("Histogram of", xname), xlim = range(breaks), ylim = NULL, xlab = xname, ylab, axes = TRUE, plot = TRUE, labels = FALSE, nclass = NULL, ...)
x |
A vector of values for which the histogram is desired. |
breaks |
Either: 1) A vector giving the breakpoints between histogram cells, OR 2) A single number giving the number of cells for the histogram, OR 3) A character string naming an algorithm to compute the number of cells (see Details), OR 4) A function to compute the number of cells. |
freq |
logical; if |
probability |
A logical value, |
include.lowest |
If |
right |
If |
density |
The density of shading lines, in lines per inch. The default
value of |
angle |
The slope of shading lines, given as an angle in degrees (counter-clockwise). |
col |
A colour to be used to fill the bars. The default of |
border |
The color of the border around the bars. The default is to use the standard foreground color. |
main |
Title of the graph. |
xlim |
A two valued vector specifying the lower and upper limits of the x axis. |
ylim |
A two valued vector specifying the lower and upper limits of the y axis. |
xlab |
X axis labels. |
ylab |
Y axis labels. |
axes |
Logical value, if |
plot |
Logical value, if |
labels |
Logical or character. Additionally draw labels on top of bars,
if not |
nclass |
Number of bins of the histogram. |
... |
Other graphical parameters, see par for details. |
See hist
help file. This function forces the number of class of
histogram to that as specified by the user.
An object of class "histogram"
which is a list with components:
breaks |
The n+1 cell boundaries (= |
counts |
N integers; for each cell, the number of |
density |
Values as estimated density values. If |
intensities |
Same as density, deprecated. |
mids |
The n cell midpoints. |
xname |
A character string with the actual |
equidist |
Logical, indicating if the distances between |
Please see hist
help file.
R development team with modifications by Steve Su
Venables, W. N. and Ripley. B. D. (2002) Modern Applied Statistics with S. Springer.
# See hist for extended example: junk<-rgamma(1000,5) # Forcing the number of bins to be 10: histsu(junk,nclass=10)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.