Description Usage Arguments Examples
Combined density/box plots.
1 2 3 4 |
x |
A continuous numeric vector. |
weights |
A vector of weights. Must be either NULL (the default) or the same length as 'x'. All complete cases of 'x' must have a non-missing value for 'weights'. |
plot |
Logical, whether to plot immediately. Default is TRUE. If FALSE, returns the plot, which can be assigned to an object. |
fence_coef |
Defines the length of boxplot whiskers & defines outliers. Defaults to the typical value of 1.5. |
label |
A character string supplying a variable name to the legend. The default, NULL, passes the argument supplied to 'x' to the legend. |
color |
Fill and line color of both density and box plots. |
alpha |
Fill transparency of both density and box plots. |
lwt |
Weight of density plot outline. |
ltype |
Line type (pattern) of density plot outline. Default is solid. For other options, see ?linetype. |
fill |
Logical. Fill the density plot? Gets color from 'color' and alpha from 'alpha'. Defaults to TRUE |
normal |
Logical. Include a simulated normal/Gaussian density plot? Gets parameters from 'x' Defaults to FALSE. |
color_norm |
Line color of the optional simulated normal plot. |
lwt_norm |
Weight of the optional simulated normal plot. |
ltype_norm |
Line type simulated normal. Default is twodash. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # basic
ndensity <- rnorm(5000)
dbox(ndensity)
# Using colors & comparison normal density plot
rskew <- 1.5^rnorm(5000) * 5
dbox(rskew, color = "orange2", fill = FALSE,
normal = TRUE, color_norm = "steelblue2")
# Assignment to an object using `plot = FALSE` and using a variable label
setosa <- subset(iris, Species == "setosa")
setosa_petLn <- dbox(setosa$Petal.Length, plot = FALSE,
label = "Setosa Petal Width", color = "orange2",
normal = TRUE, color_norm = "steelblue2")
setosa_petLn
# Using weights, a wider boxplot fence coefficient, and a thinner line
dbox::guilford
dbox(guilford$income)
dbox(guilford$income,
weights = guilford$perwt,
fence_coef = 2,
lwt = 0.8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.