bar_error {pubh} | R Documentation |
Bar charts with error bars.
Description
bar_error
constructs bar charts in with error bars showing 95
confidence intervals around mean values. High of bars represent mean values.
Usage
bar_error(
object = NULL,
formula = NULL,
data = NULL,
fill = "indianred3",
col = "black",
alpha = 0.7,
...
)
Arguments
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 |
Examples
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)
[Package pubh version 1.3.2 Index]