View source: R/plot_functions.R
strip_error | R Documentation |
strip_error
constructs strip plots with error bars showing 95
confidence intervals around mean values.
strip_error(
object = NULL,
formula = NULL,
data = NULL,
pch = 20,
size = 1,
alpha = 0.7,
col = "indianred3",
...
)
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 |
pch |
Point character passed to |
size |
Size of the symbol ( |
alpha |
Opacity of the symbol (0 = invisible, 1 = opaque). |
col |
A colour or formula used for mapping colour. |
... |
Additional information passed to |
data(energy, package = "ISwR")
require(sjlabelled, quietly = TRUE)
energy <- energy |>
var_labels(
expend = "Energy expenditure (MJ/day)",
stature = "Stature"
)
energy |>
strip_error(expend ~ stature, col = "red")
t.test(expend ~ stature, data = energy)
## Adding an horizontal line to show significant difference:
energy |>
strip_error(expend ~ stature, col = "red") |>
gf_star(1, 13, 2, 13.2, 13.4, "**")
data(birthwt, package = "MASS")
require(dplyr, quietly = TRUE)
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 |>
strip_error(bwt ~ smoke | Race, col = "darksalmon")
birthwt |>
strip_error(bwt ~ smoke, col = ~Race)
birthwt |>
strip_error(bwt ~ smoke, pch = ~Race, col = ~Race)
birthwt |>
strip_error(bwt ~ smoke | Race)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.