| whist {heR.Misc} | R Documentation |
Function adapted from VR's truehist function in MASS library
to calculate a weighted histogram
whist(data, w = NULL, nbins = NULL, h, x0 = -h/1000, plot=TRUE,
axes=TRUE, breaks, prob = TRUE, xlim = range(breaks), ymax = max(est),
col = 1, xlab = deparse(substitute(data)), bty = "n", main = NULL,
verbose=T, ...)
data |
raw data from which to calculate the histogram |
w |
vector of weights with same length as the data vector,
if NULL, then the usual histogram is produced |
nbins |
number of bins |
h |
bin width, takes precedence over nbins |
x0 |
shift for the bins |
plot |
logical, whether to produce the plot or not |
axes |
logical, whether to include the axes or not |
breaks |
actual break points, takes precendence over nbins |
prob |
logical, whether to plot probabilities or frequencies |
xlim |
two-element vector giving the x axis limits |
ymax |
the upper limit for the y axis |
col |
the color to use for histogram rectangles |
xlab |
the label for the x axis |
bty |
the box type for the histogram plot |
main |
the title of the plot |
verbose |
logical, if TRUE, then output the number of bins
and data size after NA removal |
... |
additional graphical parameters |
Deletes all records that have missing values in either
data or w.
Due to an issue with factor, this won't work
if there are zero counts in any given class interval.
This function is based on truehist by Brian Ripley
in the MASS library.
A list of histogram breaks, probabilities or weighted probabilities and sum of weights if weights are specified, normalized probabilities or weighted normalized probabilities, and the raw counts
Neil E. Klepeis
neil AT exposurescience DOT org
http://klepeis.net