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
0X2649 (Deer) 4 19 102 0.19 2.42
0X1750 (Smith) 7 39 289 0.13 2.06
0X6073 (Smith) 5 1 133 0.01 -2.00
0X8764 (Smith) 7 14 305 0.05 -1.48
0X759 (Smith) 7 14 303 0.05 -1.46
0X1982 (Smith) 7 19 345 0.06 -1.18
0X9069 (Deer) 7 9 192 0.05 -1.14
0X3289 (Deer) 5 13 251 0.05 -1.13
0X8792 (Smith) 7 15 280 0.05 -1.12
0X8609 (Doe) 4 2 72 0.03 -1.07
0X4959 (Doe) 6 16 285 0.06 -1.03
0X474 (Doe) 3 4 102 0.04 -1.01