gen_bst_df {pubh} | R Documentation |
Generate a data frame with estimate and bootstrap CIs.
Description
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).
Usage
gen_bst_df(object = NULL, formula = NULL, data = NULL, stat = "mean", ...)
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 |
stat |
Statistic used for bst. |
... |
Passes optional arguments to bst. |
Value
A data frame with the confidence intervals by level.
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 %>%
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)
[Package pubh version 1.3.2 Index]