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
0X9490 (Doe) 13 25 532 0.05 -1.56
0X6995 (Deer) 7 13 306 0.04 -1.34
0X4747 (Doe) 4 5 151 0.03 -1.17
0X700 (Deer) 4 0 50 0.00 -1.14
0X2861 (Deer) 4 6 165 0.04 -1.14
0X8090 (Doe) 9 16 318 0.05 -1.09
0X9252 (Smith) 11 33 554 0.06 -1.00