Skip to contents

`r lifecycle::badge("stable")`

This function generates a summary table for a report by joining the provided results data frame with the site-level metadata from dfGroups. It then filters and arranges the data based on certain conditions and displays the result in a datatable.

Usage

Report_MetricTable(
  dfResults,
  dfGroups = NULL,
  strGroupLevel = c("Site", "Country", "Study"),
  strGroupDetailsParams = NULL,
  vFlags = c(-2, -1, 1, 2)
)

Arguments

dfResults

`r gloss_param("dfResults")` `r gloss_extra("dfResults_filtered")`

dfGroups

`data.frame` Group-level metadata dictionary. Created by passing CTMS site and study data to [MakeLongMeta()]. Expected columns: `GroupID`, `GroupLevel`, `Param`, `Value`.

strGroupLevel

group level for the table

strGroupDetailsParams

one or more parameters from dfGroups to be added as columns in the table

vFlags

`integer` List of flag values to include in output table. Default: `c(-2, -1, 1, 2)`.

Value

A [gt::gt()] containing the summary table.

Examples

# site-level report
Report_MetricTable(
  dfResults = gsm.core::reportingResults %>%
    dplyr::filter(.data$MetricID == "Analysis_kri0001") %>%
    FilterByLatestSnapshotDate(),
  dfGroups = gsm.core::reportingGroups
)
Group Enrolled Numerator Denominator Metric Score Flag
0X1748 (Doe) 7 26 125 0.21 3.22
0X7838 (Deer) 3 8 32 0.25 2.19
0X1544 (Doe) 2 1 79 0.01 -1.58
0X9346 (Doe) 11 35 570 0.06 -1.47
0X3081 (Doe) 11 26 435 0.06 -1.37
0X5611 (Doe) 6 5 126 0.04 -1.27
0X2373 (Doe) 5 7 155 0.05 -1.25
0X958 (Deer) 11 32 497 0.06 -1.22
0X8351 (Deer) 9 28 440 0.06 -1.18
0X8764 (Smith) 4 8 162 0.05 -1.15
0X5425 (Smith) 2 2 61 0.03 -1.02
0X4671 (Smith) 2 1 43 0.02 -1.00
0X8768 (Deer) 7 5 107 0.05 -1.00