View source: R/plot_functions.R
gf_star | R Documentation |
gf_star
Is a function used to display differences between groups (see details).
gf_star(fig, x1, y1, x2, y2, y3, legend = "*", ...)
fig |
A gformula object. |
x1 |
Position in |
y1 |
Position in |
x2 |
Position in |
y2 |
Position in |
y3 |
Position in |
legend |
Character text used for annotating the plot. |
... |
Additional information passed to |
This function draws an horizontal line from coordinate (x1
, y2
)
to coordinate (x2
, y2
). Draws vertical lines below the horizontal line,
towards data, from (x1
, y1
) to (x1
, y2
) and from
(x2
, y1
) to (x2
, y2
). Finally, adds
text above the horizontal line, at the mid point between x1
and x2
.
See examples.
data(kfm, package = "ISwR")
require(sjlabelled, quietly = TRUE)
kfm <- kfm |>
var_labels(
dl.milk = "Breast-milk intake (dl/day)",
sex = "Sex",
weight = "Child weight (kg)",
ml.suppl = "Milk substitute (ml/day)",
mat.weight = "Maternal weight (kg)",
mat.height = "Maternal height (cm)"
)
kfm |>
box_plot(dl.milk ~ sex, fill = "thistle", alpha = 0.8) |>
gf_star(x1 = 1, y1 = 10.9, x2 = 2, y2 = 11, y3 = 11.2)
kfm |>
box_plot(dl.milk ~ sex, fill = "thistle", alpha = 0.8) |>
gf_star(1, 10.9, 2, 11, 11.4, legend = "p = 0.035", size = 2.5)
data(energy, package = "ISwR")
energy <- energy |>
var_labels(
expend = "Energy expenditure (MJ/day)",
stature = "Stature"
)
energy |>
strip_error(expend ~ stature, col = "red") |>
gf_star(1, 13, 2, 13.2, 13.4, "**")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.