eda_dens | R Documentation |
eda_dens
generates overlapping density distributions for
two variables.
eda_dens(
x,
y,
fac = NULL,
p = 1L,
tukey = FALSE,
fx = NULL,
fy = NULL,
grey = 0.6,
col = "red",
show.par = TRUE,
alpha = 0.4,
xlab = NULL,
ylab = NULL,
xaxis = NULL,
switch = FALSE,
legend = TRUE,
...
)
x |
Vector for first variable, or a dataframe. |
y |
Vector for second variable, or column defining the continuous
variable if |
fac |
Column defining the categorical variable if |
p |
Power transformation to apply to both sets of values. |
tukey |
Boolean determining if a Tukey transformation should be adopted (FALSE adopts a Box-Cox transformation). |
fx |
Formula to apply to x variable. This is computed after any transformation is applied to the x variable. |
fy |
Formula to apply to y variable. This is computed after any transformation is applied to the y variable. |
grey |
Grey level to apply to plot elements (0 to 1 with 1 = black). |
col |
Fill color for second density distribution. |
show.par |
Boolean determining if parameters such as power transformation or formula should be displayed. |
alpha |
Fill transparency (0 = transparent, 1 = opaque). Only applicable
if |
xlab |
X variable label. Ignored if |
ylab |
Y variable label. Ignored if |
xaxis |
Label for x-axis. Defaults to |
switch |
Boolean determining if the axes should be swapped. Only applies to dataframe input. Ignored if vectors are passed to the function. |
legend |
Boolean determining if a legend should be added to the plot. |
... |
Arguments passed to the |
This function will generate overlapping density plots with the first variable assigned a grey color and the second variable assigned the default red color.
Does not return a value.
# Passing data as two separate vector objects
set.seed(207)
x <- rbeta(1000,2,8)
y <- x * 1.5 + 0.1
eda_dens(x, y)
# Passing data as a dataframe
dat <- data.frame(val = c(x, y),
grp = c(rep("x", length(x)), rep("y", length(y))))
eda_dens(dat, val, grp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.