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
0X7983 (Smith) 4 31 243 0.13 2.24
0X213 (Smith) 15 80 742 0.11 2.22
0X9580 (Deer) 5 30 238 0.13 2.14
0X4323 (Smith) 12 39 675 0.06 -1.99
0X1137 (Deer) 5 8 196 0.04 -1.82
0X5048 (Smith) 2 0 42 0.00 -1.68
0X2865 (Smith) 2 2 71 0.03 -1.43
0X3989 (Smith) 5 7 150 0.05 -1.37
0X4707 (Deer) 3 4 97 0.04 -1.27
0X9520 (Doe) 4 4 97 0.04 -1.27
0X4959 (Doe) 6 18 304 0.06 -1.26
0X8786 (Deer) 7 25 401 0.06 -1.25
0X958 (Deer) 7 19 316 0.06 -1.23
0X5362 (Doe) 5 5 110 0.05 -1.21
0X6405 (Doe) 10 34 521 0.07 -1.21
0X2123 (Deer) 3 7 140 0.05 -1.20
0X4264 (Deer) 7 23 369 0.06 -1.20
0X2513 (Deer) 2 1 41 0.02 -1.17
0X4629 (Doe) 8 28 435 0.06 -1.17
0X7228 (Smith) 7 13 225 0.06 -1.15
0X3574 (Doe) 4 9 166 0.05 -1.13
0X5137 (Smith) 2 1 39 0.03 -1.11
0X9834 (Deer) 5 8 149 0.05 -1.09
0X6301 (Doe) 3 4 86 0.05 -1.04