gen_bst_df: Generate a data frame with estimate and bootstrap CIs.

gen_bst_dfR 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: y ~ x or y ~ x|z where y is a numerical variable and both x and z are factors.

data

A data frame where the variables in the formula can be found.

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(Fentress)

Fentress |> gen_bst_df(pain ~ group)

pubh documentation built on Nov. 1, 2026, 9:06 a.m.