Skip to contents

Returns a tidy table of summary stats

Usage

summary_stats(
  df,
  condition = NULL,
  group_vars = NULL,
  summary_vars = NULL,
  arr = NULL
)

Arguments

df

data frame

condition

filter condition, i.e. patient == "new"

group_vars

variables to group by, i.e. c(specialty, state, hcpcs, cost)

summary_vars

variables to summarise, i.e. c(min, max, mode, range)

arr

column to arrange data by, i.e. cost

Value

A tidytable containing the summary stats

Examples

if (FALSE) {
download_datasets(specialty = "vascular surgery") |>
tidytable::slice_head(n = 10) |>
summary_stats(condition = patient == "new",
              group_vars = c(specialty, state, hcpcs, cost),
              summary_vars = c(min, max, mode, range),
              arr = cost)
}