gen_bst_df | R Documentation |
gen_bst_df
is a function called that generates a data frame with
confidence intervals of a continuous variable by levels of one or two categorical ones (factors).
gen_bst_df(object = NULL, formula = NULL, data = NULL, stat = "mean", ...)
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 |
stat |
Statistic used for bst. |
... |
Passes optional arguments to bst. |
A data frame with the confidence intervals by level.
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 |>
gen_bst_df(dl.milk ~ sex)
data(birthwt, package = "MASS")
require(dplyr, quietly = TRUE)
birthwt <- mutate(birthwt,
smoke = factor(smoke, labels = c("Non-smoker", "Smoker")),
Race = factor(race > 1, labels = c("White", "Non-white"))
)
birthwt <- birthwt |>
var_labels(
bwt = "Birth weight (g)",
smoke = "Smoking status"
)
gen_bst_df(bwt ~ smoke | Race, data = birthwt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.