View source: R/plot_functions.R
bar_error | R Documentation |
bar_error
constructs bar charts in with error bars showing 95
confidence intervals around mean values. High of bars represent mean values.
bar_error(
object = NULL,
formula = NULL,
data = NULL,
fill = "indianred3",
col = "black",
alpha = 0.7,
...
)
object |
When chaining, this holds an object produced in the earlier portions of the chain. Most users can safely ignore this argument. See details and examples. |
formula |
A formula with shape: |
data |
A data frame where the variables in the |
fill |
Colour used to fill the bars. |
col |
Colour used for the borders of the bars. |
alpha |
Opacity of the colour fill (0 = invisible, 1 = opaque). |
... |
Additional information passed to |
require(dplyr, quietly = TRUE)
require(sjlabelled, quietly = TRUE)
data(birthwt, package = "MASS")
birthwt <- birthwt |>
mutate(
smoke = factor(smoke, labels = c("Non-smoker", "Smoker")),
Race = factor(race > 1, labels = c("White", "Non-white"))
) |>
var_labels(
bwt = "Birth weight (g)",
smoke = "Smoking status"
)
birthwt |>
bar_error(bwt ~ smoke, fill = "plum3")
birthwt |>
bar_error(bwt ~ smoke | Race, fill = "plum3")
birthwt |>
bar_error(bwt ~ smoke, fill = ~Race)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.