Skip to contents

A widget that creates a simaerep visualisation of group-level metric results. It plots the mean cumulative numerator count per denominator in the left panel and highlights groups based on the over and under-reporting probability calculated by the simaerep bootstrap algorithm. Flagged groups are shown in the right panel including the total numerator counts per single patient.

Usage

Widget_Simaerep(
  dfInput,
  dfFlagged,
  dfGroups = NULL,
  lMetric = NULL,
  strStudyId = "StudyID",
  strScoreCol = "Score",
  vColors = NULL,
  bAddGroupSelect = TRUE,
  strShinyGroupSelectID = "GroupID",
  strOutputLabel = paste0(fontawesome::fa("chart-line", fill = "#337ab7"), "  Simaerep"),
  ...
)

Arguments

dfInput

data.frame created by Input_CumCount()

dfFlagged

data.frame created by Flag_Simaerep()

dfGroups

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

lMetric

`list` Metric-specific metadata for use in charts and reporting. Created by passing an `lWorkflow` object to [MakeMetric()] and turing it into a list. Expected columns: `File`,`MetricID`, `Group`, `Abbreviation`, `Metric`, `Numerator`, `Denominator`, `Model`, `Score`, and `strThreshold`. For more details see the Data Model vignette: `vignette("DataModel", package = "gsm.kri")`.

strStudyId

character, study label, Default: "StudyID"

strScoreCol

character, name of score column in dfFlagged, Default: "Score"

vColors

vector, named hex values for every Flag value in dfFlagged$Flag, Default NULL

bAddGroupSelect

`logical` Add a dropdown to highlight sites? Default: `TRUE`.

strShinyGroupSelectID

`character` Element ID of group select in Shiny context. Default: `'GroupID'`.

strOutputLabel

`character` Label describing the output object, which is assigned to the `output_label` attribute of the output object and appears in the report generated by [gsm.kri::Report_KRI()]..

...

`any` Additional chart configuration settings.

Value

An htmlwidget object that can be rendered in R Markdown reports or Shiny apps.

See also

Widget_SimaerepOutput for use in Shiny apps renderWidget_Simaerep for use in Shiny apps

Examples


 dfInput <- Input_CumCount(
   dfSubjects = clindata::rawplus_dm,
   dfNumerator = clindata::rawplus_ae,
   dfDenominator = clindata::rawplus_visdt %>% dplyr::mutate(visit_dt = lubridate::ymd(visit_dt)),
   strSubjectCol = "subjid",
   strGroupCol = "invid",
   strGroupLevel = "Site",
   strNumeratorDateCol = "aest_dt",
   strDenominatorDateCol = "visit_dt"
 )

 dfAnalyzed <- Analyze_Simaerep(dfInput)
 dfFlagged <- Flag_Simaerep(dfAnalyzed, vThreshold = c(-0.99, -0.95, 0.95, 0.99))
#>  Sorted dfFlagged using custom Flag order: 2.Sorted dfFlagged using custom Flag order: -2.Sorted dfFlagged using custom Flag order: 1.Sorted dfFlagged using custom Flag order: -1.Sorted dfFlagged using custom Flag order: 0.

 Widget_Simaerep(dfInput, dfFlagged)