Tabulate the number of rows in a data frame.

ard_tabulate_rows(
  data,
  colname = "..row_count..",
  by = dplyr::group_vars(data),
  strata = NULL,
  fmt_fun = NULL
)

Arguments

data

(data.frame)
a data frame

colname

(string)
name of the column that will be returned along with the row tabulation.

by, strata

(tidy-select)
columns to use for grouping or stratifying the table output. Arguments are similar, but with an important distinction:

by: results are tabulated by all combinations of the columns specified, including unobserved combinations and unobserved factor levels.

strata: results are tabulated by all observed combinations of the columns specified.

Arguments may be used in conjunction with one another.

fmt_fun

(formula-list-selector)
a named list, a list of formulas, or a single formula where the list element is a named list of functions (or the RHS of a formula), e.g. list(mpg = list(mean = \(x) round(x, digits = 2) |> as.character())).

Value

an ARD data frame of class 'card'

Examples

ard_tabulate_rows(ADSL, by = TRTA)
#> # An ARD data frame: 3 × 11
#>   group1 group1_level variable variable_level context stat_name stat_label  stat
#>   <chr>  <list>       <chr>    <list>         <chr>   <chr>     <chr>      <lis>
#> 1 TRTA   Placebo      ..row_c… TRUE           tabula… n         n             86
#> 2 TRTA   Xanomeline … ..row_c… TRUE           tabula… n         n             84
#> 3 TRTA   Xanomeline … ..row_c… TRUE           tabula… n         n             84
#> # ℹ 3 more variables: fmt_fun <list>, warning <list>, error <list>