prep_big_n: Prepare 'bigN' stat variables

View source: R/prep_card.R

prep_big_nR Documentation

Prepare bigN stat variables

Description

[Experimental]

prep_big_n():

  • recodes the "n" stat_name into bigN for the desired variables, and

  • drops all other stat_names for the same variables.

If your tfrmt contains a big_n_structure() you pass the tfrmt column to prep_big_n() via vars.

Usage

prep_big_n(df, vars)

Arguments

df

(data.frame)

vars

(character) a vector of variables to prepare bigN for.

Value

a data.frame with the same columns as the input. The stat_name column is modified.

Examples

df <- data.frame(
  stat_name = c("n", "max", "min", rep(c("n", "N", "p"), times = 2)),
  context = rep(c("continuous", "hierarchical", "categorical"), each = 3),
  stat_variable = rep(c("a", "b", "c"), each = 3)
) |>
  dplyr::bind_rows(
    data.frame(
      stat_name = "n",
      context = "total_n",
      stat_variable = "d"
    )
  )

prep_big_n(
  df,
  vars = c("b", "c")
)

tfrmt documentation built on Nov. 5, 2025, 6:12 p.m.