strip_error {pubh} | R Documentation |
Strip plots with error bars.
Description
strip_error
constructs strip plots with error bars showing 95
confidence intervals around mean values.
Usage
strip_error(
object = NULL,
formula = NULL,
data = NULL,
pch = 20,
size = 1,
alpha = 0.7,
col = "indianred3",
...
)
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 |
pch |
|
size |
Size of the symbol ( |
alpha |
Opacity of the symbol (0 = invisible, 1 = opaque). |
col |
A colour or formula used for mapping colour. |
... |
Examples
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) %>%
gf_refine(ggsci::scale_color_jama())
birthwt %>%
strip_error(bwt ~ smoke, pch = ~Race, col = ~Race) %>%
gf_refine(ggsci::scale_color_jama())
birthwt %>%
strip_error(bwt ~ smoke | Race)
[Package pubh version 1.3.2 Index]