cond_barplot | R Documentation |
cond_barplot()
conditions all variables on x
by quantile binning and
shows the median or mean of the other variables for each x
.
cond_barplot(
data,
x = NULL,
n = 100,
min_bin_size = NULL,
overlap = NULL,
ncols = NULL,
fill = "#2f4f4f",
auto_fill = FALSE,
show_bins = FALSE,
type = c("median", "mean"),
...
)
data |
a |
x |
|
n |
|
min_bin_size |
|
overlap |
|
ncols |
The number of column to be used in the layout. |
fill |
The color to use for the bars. |
auto_fill |
If |
show_bins |
If |
type |
The type of statistic to use for the bars. |
... |
Additional arguments to pass to the plot functions |
A list
of ggplot objects.
Other conditional quantile plotting functions:
cond_boxplot()
,
cond_heatmap()
,
funq_plot()
# plots the expected median conditional on Sepal.Width
cond_barplot(iris, "Sepal.Width", n = 12)
# plots the expected median
cond_barplot(iris, "Sepal.Width", n = 12, show_bins = TRUE)
data("diamonds", package="ggplot2")
cond_barplot(diamonds[c(1:4, 7)], "carat", auto_fill = TRUE)
if (require(palmerpenguins)) {
p <- cond_barplot(penguins[1:7], "body_mass_g", auto_fill = TRUE)
print(p)
# compare with qbin_boxplot
p <- cond_boxplot(penguins[1:7], "body_mass_g", auto_fill = TRUE)
print(p)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.