Find the proper function to apply to each statistical and column block pairing and use the metadata associated with each column block for the function's arguments

app_methods(agg, column, week, group, data, totals, filter = NA)

Arguments

agg

the statistic to apply given the block name

column

the column to apply that statistic too, and class of the column dictated by the data frame it came from

week

the week if needed for calculation

group

whether to perform a group_by and if so by which column

data

the dataset to perform all functions on

totals

the totals data frame that contains denominator N's use when calculating column percentages

filter

a string denoting the additional filter to apply to the dataset

Value

the table corresponding to the proper function to perform given the supplied column. This is used within a map to apply to all blocks inside the table generator module.

Examples

if(interactive()){
  data(example_dat1, package = "tidyCDISC")

  # Create non-missing table section
  app_methods("NON_MISSING", 
             structure("USUBJID", class = c("character", "ADSL")), NA, 
             "TRT01P", example_dat1$AE, example_dat1$totals)
            
  # Create ANOVA table section
  app_methods("ANOVA", 
            structure("TEMP", class = c("character", "BDS")), "Week 2", 
            "TRT01P", example_dat1$BDS, example_dat1$totals)

  # Create change table section
  app_methods("CHG", 
            structure("WEIGHT", class = c("character", "BDS")), "Week 12", 
            "TRT01P", example_dat1$BDS, example_dat1$totals)

  # Create mean table section
  app_methods("MEAN", 
            structure("PULSE", class = c("character", "BDS")), "Baseline", 
            "TRT01P", example_dat1$BDS, example_dat1$totals)
}