Usage
histogram(formula,
data,
type = c("percent", "count", "density"),
nint = if(is.factor(x)) length(levels(x))
else round(log2(length(x))+1),
endpoints = range(x[!na.x]),
breaks = if(is.factor(x)) seq(0.5, length = length(levels(x))
+ 1) else do.breaks(endpoints, nint),
equal.widths = FALSE,
...)
Arguments
formula
A formula of the form ~ x | g1 * g2 * ...
indicates that histograms of x
should be produced conditioned
on the levels of the (optional) variables g1,g2,...
.
x
can be numeric or factor, a
data
data frame in which variables are to be evaluated
type
Character string indicating type of histogram to be
drawn. "percent" and "count" give relative frequency and frequency
histograms, and can be misleading when breakpoints are not equally
spaced. "density" produces a density scale histogram. (Se
nint
Number of bins. Applies only when breaks
is
unspecified in the call.
endpoints
vector of length 2 indicating the range of x-values
that is to be covered by the histogram. Again, applies only when
breaks
is unspecified.
breaks
numeric vector of length = (number of bins + 1)
defining the breakpoints of the bins. Note that when breakpoints are
not equally spaced, the only value of type
that makes sense
is density. Usually all panels use the same brea
equal.widths
logical, relevant only when breaks=NULL
.
If TRUE
, equally spaced bins will be selected, otherwise,
approximately equal area bins will be selected (this would mean that
the breakpoints will not be equally space
synopsis
histogram(formula, data = parent.frame(), aspect = "fill", layout = NULL,
panel = panel.histogram, prepanel = NULL, scales = list(),
strip = TRUE, groups = NULL, xlab, xlim, ylab, ylim, type = c("percent",
"count", "density"), nint, endpoints = range(x[!is.na(x)]), breaks,
equal.widths = TRUE, ..., subscripts = !is.null(groups),
subset = TRUE)