estat: Descriptive statistics for continuous variables.

View source: R/descriptive_functions.R

estatR Documentation

Descriptive statistics for continuous variables.

Description

estat calculates descriptives of numerical variables.

Usage

estat(object = NULL, formula = NULL, data = NULL, digits = 2, label = NULL)

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: ~ x or ~ x|z (for groups).

data

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

digits

Number of digits for rounding (default = 2).

label

Label used to display the name of the variable (see examples).

Value

A data frame with descriptive statistics.

See Also

summary.

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 |>
  estat(~dl.milk)

estat(~ dl.milk | sex, data = kfm)

kfm |>
  estat(~ weight | sex)

pubh documentation built on Oct. 8, 2024, 9:08 a.m.