densityplot.Rd
This is a wrapper to the typical ggplot
based density plot, i.e., using
geom_density
. A continuous variable, x
, is required as an input.
Optionally, a by
categorical variable can be provided.
densityplot( x, data, by = NULL, position = "stack", facet = NULL, facet_type = "wrap", alpha = 1, xlab = NULL, ylab = NULL )
x | The numeric variable that is to be density plotted. |
---|---|
data | A data frame with at least one numeric variable (the |
by | A categorical variable by which to group the |
position | If the |
facet | A character string or character vector. If provided, we
|
facet_type | By default, this takes the value of |
alpha | The transparency to for the filled histogram bars. This is
probably only required when using |
xlab | The label of the x-axis (defaults to the |
ylab | The label of the y-axis (defaults to the |
A ggplot2::ggplot
object, which may be modified with further ggplot2
commands.
densityplot(x = age, data = schizophrenia, by = gender)