byf.hist: Histogram for factor levels
Description
Draws a histogram of a numeric variable per level of a factor.
Usage
byf.hist(formula, data, sep = FALSE, density = TRUE, xlab = NULL, ylab = NULL,
col = NULL)
Arguments
- formula
a formula of the form a ~ b
where a
gives the data values and b
a factor giving the corresponding groups.
- data
an optional data frame containing the variables in the formula formula
. By default the variables are taken from environment(formula)
.
- sep
logical. If TRUE
a histogram is displayed per level of the factor. If FALSE
all levels are displayed on the same histogram.
- density
logical. If TRUE
density polygons are displayed, if FALSE
classical counts are displayed.
- xlab
label for x-axis (name of the response variable as default).
- ylab
label for y-axis ("Density" or "Frequency" as default, depending on the type of histogram).
- col
color(s) used for density curves or bars.
Author
Maxime HERVE <maxime.herve@univ-rennes1.fr>
Examples
Run this codedata(iris)
byf.hist(Sepal.Length~Species,data=iris)
Run the code above in your browser using DataLab