Skip to contents

For several SQUBA modules, this function is used to create a summary reference table that displays a more detailed breakdown of concept usage

Usage

generate_ref_table(tbl, id_col, name_col, denom, time = FALSE)

Arguments

tbl

tabular input || required

A table, typically generated within an *_output function, that contains the concepts of interest to be displayed in the reference table

id_col

string || required

The name of the column with the concepts to be summarized in the reference table

name_col

string || required

The name of the column with the concept name associated with the concept in id_col

denom

string || required

The name of the column with a denominator count (or any numerical value) associated with id_col to be displayed in the reference table

time

boolean || defaults to FALSE

A boolean indicating whether the input data is stratified by time. For over time analyses, the provided denom column will be summed across the entire time period and an all-time value will be displayed.

Value

A gt reference table with summary information about the concepts included in the provided table. This is typically included as a complement to other graphical output.

Examples

# generate reference table for non-time dependent concept summary

input_tbl_notime <- dplyr::tibble('concept_id' = c(1, 2, 3, 4),
                                  'concept_name' = c('test1', 'test2',
                                                     'test3', 'test4'),
                                  'ct_concept' = c(100, 200, 300, 400),
                                  'site' = c('Site A', 'Site A', 'Site A',
                                  'Site A'))

generate_ref_table(tbl = input_tbl_notime,
                   id_col = 'concept_id',
                   name_col = 'concept_name',
                   denom = 'ct_concept',
                   time = FALSE)
Concept Reference Table
# generate reference table for time dependent concept summary input_tbl_time <- dplyr::tibble('concept_id' = c(1, 2, 3, 4, 1, 2, 3, 4), 'time_start' = c('2012-01-01', '2012-01-01', '2012-01-01', '2012-01-01', '2013-01-01', '2013-01-01', '2013-01-01', '2013-01-01'), 'time_increment' = c('year','year','year', 'year','year','year', 'year','year'), 'concept_name' = c('test1', 'test2', 'test3', 'test4', 'test1', 'test2', 'test3', 'test4'), 'ct_concept' = c(100, 200, 300, 400, 200, 300, 400, 500), 'site' = c('Site A', 'Site A', 'Site A', 'Site A', 'Site A', 'Site A', 'Site A', 'Site A')) generate_ref_table(tbl = input_tbl_time, id_col = 'concept_id', name_col = 'concept_name', denom = 'ct_concept', time = TRUE)
Concept Reference Table