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
0X3601 (Doe) 5 11 51 0.22 2.74
0X6603 (Smith) 4 31 236 0.13 2.14
0X7514 (Deer) 5 18 120 0.15 2.12
0X101 (Deer) 5 25 183 0.14 2.09
0X9346 (Doe) 9 21 422 0.05 -1.97
0X4264 (Deer) 9 17 339 0.05 -1.75
0X2005 (Deer) 5 2 89 0.02 -1.65
0X1750 (Smith) 6 13 267 0.05 -1.62
0X2901 (Doe) 5 10 216 0.05 -1.56
0X6865 (Smith) 3 1 64 0.02 -1.56
0X4485 (Doe) 11 33 537 0.06 -1.44
0X958 (Deer) 5 15 280 0.05 -1.42
0X554 (Deer) 3 4 110 0.04 -1.41
0X8764 (Smith) 3 7 154 0.05 -1.35
0X213 (Smith) 10 46 689 0.07 -1.23
0X3973 (Doe) 6 9 173 0.05 -1.18
0X9569 (Doe) 4 3 80 0.04 -1.18
0X4629 (Doe) 6 24 381 0.06 -1.13
0X2970 (Deer) 7 12 213 0.06 -1.12
0X9737 (Doe) 7 26 404 0.06 -1.08
0X187 (Smith) 6 8 151 0.05 -1.07
0X8274 (Smith) 4 1 40 0.03 -1.06