diff --git a/DESCRIPTION b/DESCRIPTION index 16e4363..74e2694 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -62,4 +62,4 @@ Suggests: Remotes: ohdsi/ReportGenerator, ohdsi/ResultModelManager -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/R/estimation-cohort-method-covariateBalance.R b/R/estimation-cohort-method-covariateBalance.R index 7041056..39656b2 100644 --- a/R/estimation-cohort-method-covariateBalance.R +++ b/R/estimation-cohort-method-covariateBalance.R @@ -112,6 +112,7 @@ cohortMethodCovariateBalanceServer <- function( analysisId = row$analysisId)}, error = function(e){return(data.frame())} ) + return(balance) }) @@ -127,6 +128,22 @@ cohortMethodCovariateBalanceServer <- function( ) balancePlot <- shiny::reactive({ + + row <- selectedRow() + if(is.null(row$targetId)){ + return(NULL) + } + + maxSdmStatistic <- estimationGetMaxSdm( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + targetId = row$targetId, + comparatorId = row$comparatorId, + outcomeId = row$outcomeId, + analysisId = row$analysisId, + databaseId = row$databaseId + ) + if (is.null(balance()) || nrow(balance()) == 0) { return(NULL) } else { @@ -134,7 +151,8 @@ cohortMethodCovariateBalanceServer <- function( balance = balance(), beforeLabel = "Before propensity score adjustment", afterLabel = "After propensity score adjustment", - textsearch = textSearchCohortMethod + textsearch = textSearchCohortMethod, + maxSdmStatistic ) return(plot) } @@ -151,7 +169,7 @@ cohortMethodCovariateBalanceServer <- function( row <- selectedRow() text <- "Figure 3. Covariate balance before and after propensity score adjustment. Each dot represents the standardizes difference of means for a single covariate before and after propensity score adjustment on the propensity - score. Move the mouse arrow over a dot for more details." + score. The maximum absolute standardized difference of the mean (Max SDM) is given at the top of the figure. Move the mouse arrow over a dot for more details." return(shiny::HTML(sprintf(text))) } }) @@ -421,13 +439,24 @@ getCohortMethodCovariateBalanceSummary <- function( } +cmDiagnostics <- shiny::reactive({ + estimationGetCmDiagnostics( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + targetIds = targetIds, + comparatorIds = comparatorIds, + outcomeId = outcomeId + ) +}) + plotCohortMethodCovariateBalanceScatterPlotNew <- function( balance, beforeLabel = "Before propensity score adjustment", afterLabel = "After propensity score adjustment", - textsearch = shiny::reactiveVal(NULL) + textsearch = shiny::reactiveVal(NULL), + maxSdmStatistic = NULL ){ if(is.null(textsearch())){ @@ -469,6 +498,7 @@ plotCohortMethodCovariateBalanceScatterPlotNew <- function( ) %>% plotly::layout( #shapes = list(xyline(limits)), + title = ~paste0("Max SDM Statistic = ", maxSdmStatistic), shapes = list(list( type = "line", x0 = 0, @@ -589,6 +619,57 @@ getCmOptions <- function(connectionHandler, } +estimationGetMaxSdm <- function( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + targetId = targetId, + comparatorId = comparatorId, + outcomeId = outcomeId, + analysisId = analysisId, + databaseId = databaseId +){ + + sql <- " + SELECT DISTINCT + dmd.cdm_source_abbreviation database_name, + cmds.analysis_id, + cmds.target_id, + cmds.comparator_id, + cmds.outcome_id, + cmds.max_sdm, + cmds.ease + FROM + @schema.@cm_table_prefixdiagnostics_summary cmds + INNER JOIN @schema.@database_table dmd ON dmd.database_id = cmds.database_id + + where cmds.target_id = @target_id + and cmds.comparator_id = @comparator_id + and cmds.outcome_id = @outcome_id + and cmds.analysis_id = @analysis_id + and cmds.database_id = '@database_id' + ; + " + + result <- connectionHandler$queryDb( + sql = sql, + schema = resultDatabaseSettings$schema, + cm_table_prefix = resultDatabaseSettings$cmTablePrefix, + database_table = resultDatabaseSettings$databaseTable, + target_id = targetId, + comparator_id = comparatorId, + outcome_id = outcomeId, + analysis_id = analysisId, + database_id = databaseId + ) + + maxSdm <- round(result$maxSdm, 4) + + return( + maxSdm + ) + +} + diff --git a/R/estimation-cohort-method-power.R b/R/estimation-cohort-method-power.R index 2acec47..d54cb99 100644 --- a/R/estimation-cohort-method-power.R +++ b/R/estimation-cohort-method-power.R @@ -30,10 +30,25 @@ cohortMethodPowerViewer <- function(id) { ns <- shiny::NS(id) shiny::div( - shiny::uiOutput(outputId = ns("powerTableCaption")), - shiny::tableOutput(outputId = ns("powerTable")), - shiny::uiOutput(outputId = ns("timeAtRiskTableCaption")), - shiny::tableOutput(outputId = ns("timeAtRiskTable")) + shiny::tabsetPanel( + type = 'pills', + id = ns('power'), + + shiny::tabPanel( + title = "Power Table", + resultTableViewer(ns("powerTable"), + downloadedFileName = "powerTable-"), + shiny::uiOutput(outputId = ns("powerTableCaption")) + ), + + shiny::tabPanel( + title = "TAR Table", + resultTableViewer(ns("timeAtRiskTable"), + downloadedFileName = "timeAtRiskTable-"), + shiny::uiOutput(outputId = ns("timeAtRiskTableCaption")) + ) + + ) ) } @@ -74,36 +89,102 @@ cohortMethodPowerServer <- function( } }) - output$powerTable <- shiny::renderTable({ + powerTable <- shiny::reactive({ row <- selectedRow() if (is.null(row$target)) { return(NULL) } else { - table <- prepareCohortMethodPowerTable( - row, - connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings - ) - if (!row$unblind) { - table$targetOutcomes <- NA - table$comparatorOutcomes <- NA - table$targetIr <- NA - table$comparatorIr <- NA - } - colnames(table) <- c("Target subjects", - "Comparator subjects", - "Target years", - "Comparator years", - "Target events", - "Comparator events", - "Target IR (per 1,000 PY)", - "Comparator IR (per 1,000 PY)", - "MDRR") + table <- prepareCohortMethodPowerTable( + row, + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings + ) + if (!row$unblind) { + table$targetOutcomes <- NA + table$comparatorOutcomes <- NA + table$targetIr <- NA + table$comparatorIr <- NA + } + colnames(table) <- c("targetSubjects", + "comparatorSubjects", + "targetYears", + "comparatorYears", + "targetEvents", + "comparatorEvents", + "targetIr", # (per 1,000 PY)", + "comparatorIr", # (per 1,000 PY)", + "mdrr") return(table) } }) + estimationPowerTableColDefs <- function(){ + result <- list( + targetSubjects = reactable::colDef( + header = withTooltip("Target Subjects", + "Number of subjects in the target cohort"), + filterable = T + ), + comparatorSubjects = reactable::colDef( + header = withTooltip("Comparator Subjects", + "Number of subjects in the comparator cohort"), + filterable = T + ), + targetYears = reactable::colDef( + header = withTooltip("Target Years", + "Number of years of follow-up time in the target cohort"), + filterable = T + ), + comparatorYears = reactable::colDef( + header = withTooltip("Comparator Years", + "Number of years of follow-up time in the comparator cohort"), + filterable = T + ), + targetEvents = reactable::colDef( + header = withTooltip("Target Events", + "Distinct number of outcome events in the target cohort"), + filterable = T + # cell = function(value) { + # # Add < if cencored + # if (value < 0 ) paste("<", abs(value)) else abs(value) + # } + ), + comparatorEvents = reactable::colDef( + header = withTooltip("Comparator Events", + "Distinct number of outcome events in the comparator cohort"), + filterable = T + # cell = function(value) { + # # Add < if cencored + # if (value < 0 ) paste("<", abs(value)) else abs(value) + # } + ), + targetIr = reactable::colDef( + header = withTooltip("Target IR (per 1,000 PY)", + "Incidence rate per 1,000 person-years in the target cohort"), + filterable = T + ), + comparatorIr = reactable::colDef( + header = withTooltip("Comparator IR (per 1,000 PY)", + "Incidence rate per 1,000 person-years in the comparator cohort"), + filterable = T + ), + mdrr = reactable::colDef( + header = withTooltip("MDRR", + "The minimum detectable relative risk"), + filterable = T + ) + ) + return(result) + } + + resultTableServer( + id = "powerTable", + df = powerTable, + colDefsInput = estimationPowerTableColDefs(), + downloadedFileName = "powerTable-" + ) + output$timeAtRiskTableCaption <- shiny::renderUI({ row <- selectedRow() if (!is.null(row$target)) { @@ -116,25 +197,110 @@ cohortMethodPowerServer <- function( } }) - output$timeAtRiskTable <- shiny::renderTable({ + timeAtRiskTable <- shiny::reactive({ row <- selectedRow() if (is.null(row$target)) { return(NULL) } else { - followUpDist <- getCmFollowUpDist( - connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings, - targetId = row$targetId, - comparatorId = row$comparatorId, - outcomeId = row$outcomeId, - databaseId = row$databaseId, - analysisId = row$analysisId - ) + followUpDist <- getCmFollowUpDist( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + targetId = row$targetId, + comparatorId = row$comparatorId, + outcomeId = row$outcomeId, + databaseId = row$databaseId, + analysisId = row$analysisId + ) table <- prepareCohortMethodFollowUpDistTable(followUpDist) return(table) } }) + + estimationTimeAtRiskTableColDefs <- function(){ + result <- list( + Cohort = reactable::colDef( + header = withTooltip("Cohort", + "Indicates which cohort (target or comparator)"), + filterable = T + ), + Min = reactable::colDef( + header = withTooltip("Min", + "Minimum time (days) at-risk"), + filterable = T + ), + P10 = reactable::colDef( + header = withTooltip("P10", + "10th percentile time (days) at-risk"), + filterable = T + ), + P25 = reactable::colDef( + header = withTooltip("P25", + "25th percentile time (days) at-risk"), + filterable = T + ), + Median = reactable::colDef( + header = withTooltip("Median", + "Median time (days) at-risk"), + filterable = T + ), + P75 = reactable::colDef( + header = withTooltip("P75", + "75th percentile time (days) at-risk"), + filterable = T + ), + P90 = reactable::colDef( + header = withTooltip("P90", + "90th percentile time (days) at-risk"), + filterable = T + ), + Max = reactable::colDef( + header = withTooltip("Max", + "Maximum time (days) at-risk"), + filterable = T + ) + ) + return(result) + } + + resultTableServer( + id = "timeAtRiskTable", + df = timeAtRiskTable, + colDefsInput = estimationTimeAtRiskTableColDefs(), + downloadedFileName = "timeAtRiskTable-" + ) + + output$timeAtRiskTableCaption <- shiny::renderUI({ + row <- selectedRow() + if (!is.null(row$target)) { + text <- "Table 1b. Time (days) at risk distribution expressed as + minimum (min), 25th percentile (P25), median, 75th percentile (P75), and maximum (max) in the target + (%s) and comparator (%s) cohort after propensity score adjustment." + return(shiny::HTML(sprintf(text, row$target, row$comparator))) + } else { + return(NULL) + } + }) + + # output$timeAtRiskTable <- shiny::renderTable({ + # row <- selectedRow() + # if (is.null(row$target)) { + # return(NULL) + # } else { + # followUpDist <- getCmFollowUpDist( + # connectionHandler = connectionHandler, + # resultDatabaseSettings = resultDatabaseSettings, + # targetId = row$targetId, + # comparatorId = row$comparatorId, + # outcomeId = row$outcomeId, + # databaseId = row$databaseId, + # analysisId = row$analysisId + # ) + # + # table <- prepareCohortMethodFollowUpDistTable(followUpDist) + # return(table) + # } + # }) }) } @@ -280,4 +446,4 @@ getCmFollowUpDist <- function( database_id = databaseId ) ) -} +} \ No newline at end of file diff --git a/R/estimation-cohort-method-propensityModel.R b/R/estimation-cohort-method-propensityModel.R index 9cc201b..070bf1c 100644 --- a/R/estimation-cohort-method-propensityModel.R +++ b/R/estimation-cohort-method-propensityModel.R @@ -66,9 +66,22 @@ cohortMethodPropensityModelServer <- function( comparatorId = selectedRow()$comparatorId, databaseId = selectedRow()$databaseId, analysisId = selectedRow()$analysisId - ) + ) %>% + dplyr::mutate(absBeta = abs(.data$coefficient)) }) + # ColorBrewer-inspired 3-color scale + Yellows <- function(x) grDevices::rgb(grDevices::colorRamp(c("#FFFFDD", "#FFFFB9", "#FFFF79")) + (x), maxColorValue = 255) + + # ColorBrewer-inspired 3-color scale + Blues <- function(x) grDevices::rgb(grDevices::colorRamp(c("aliceblue", "lightblue1", "skyblue2")) + (x), maxColorValue = 255) + + # ColorBrewer-inspired 3-color scale + Greens <- function(x) grDevices::rgb(grDevices::colorRamp(c("#E8FDCF", "yellowgreen")) + (x), maxColorValue = 255) + resultTableServer( id = 'propensityModelTable', df = data, @@ -77,11 +90,34 @@ cohortMethodPropensityModelServer <- function( show = F ), coefficient = reactable::colDef( - name = 'Beta', + name = 'Beta', + cell = function(value) { + if (value >= 0) paste0("+", round(value, 3)) else round(value, 3) + }, + style = function(value) { + color <- if (value > 0) { + "#B0D5FE" + } else if (value < 0) { + "#FEBABA" + } + list(background = color) + }, format = reactable::colFormat( digits = 3 ) ), + absBeta = reactable::colDef( + name = 'Beta (Absolute Value)', + format = reactable::colFormat( + digits = 3 + ), + style = function(value) { + if (!is.numeric(value)) return() + normalized <- (value - min(data()$absBeta)) / (max(data()$absBeta) - min(data()$absBeta)) + color <- Greens(normalized) + list(background = color) + } + ), covariateName = reactable::colDef( name = 'Covariate' ) diff --git a/R/estimation-cohort-method-propensityScoreDistribution.R b/R/estimation-cohort-method-propensityScoreDistribution.R index 7a5eb20..cbac7f1 100644 --- a/R/estimation-cohort-method-propensityScoreDistribution.R +++ b/R/estimation-cohort-method-propensityScoreDistribution.R @@ -32,7 +32,8 @@ cohortMethodPropensityScoreDistViewer <- function(id) { shiny::plotOutput(outputId = ns("psDistPlot")), shiny::div(shiny::strong("Figure 2."),"Preference score distribution. The preference score is a transformation of the propensity score that adjusts for differences in the sizes of the two treatment groups. A higher overlap indicates subjects in the - two groups were more similar in terms of their predicted probability of receiving one treatment over the other."), + two groups were more similar in terms of their predicted probability of receiving one treatment over the other. + The equipoise statistic is also given at the top of the figure."), shiny::div(style = "display: inline-block;vertical-align: top;margin-bottom: 10px;", shiny::downloadButton(outputId = ns("downloadPsDistPlotPng"), label = "Download plot as PNG"), @@ -88,7 +89,17 @@ cohortMethodPropensityScoreDistServer <- function( comparatorName <- row$comparator - plot <- plotCohortMethodPs(ps, targetName, comparatorName) + equipoiseStatistic <- getCohortMethodEquipoise( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + targetId = row$targetId, + comparatorId = row$comparatorId, + outcomeId = row$outcomeId, + analysisId = row$analysisId, + databaseId = row$databaseId + ) + + plot <- plotCohortMethodPs(ps, targetName, comparatorName, equipoiseStatistic) return(plot) } }) @@ -113,6 +124,55 @@ cohortMethodPropensityScoreDistServer <- function( ) } +getCohortMethodEquipoise <- function( + connectionHandler, + resultDatabaseSettings, + targetId, + comparatorId, + outcomeId, + analysisId, + databaseId = NULL +) { + if(is.null(targetId)){ + return(NULL) + } + sql <- " + SELECT + database_id, target_id, comparator_id, outcome_id, analysis_id, equipoise + FROM + @schema.@cm_table_prefixdiagnostics_summary cmpsd + WHERE + cmpsd.target_id = @target_id + AND cmpsd.comparator_id = @comparator_id + AND cmpsd.analysis_id = @analysis_id + AND cmpsd.outcome_id = @outcome_id + " + if(!is.null(databaseId)) { + sql <- paste(sql, paste("AND cmpsd.database_id = '@database_id'"), collapse = "\n") + } + + + result <- connectionHandler$queryDb( + sql = sql, + schema = resultDatabaseSettings$schema, + cm_table_prefix = resultDatabaseSettings$cmTablePrefix, + target_id = targetId, + comparator_id = comparatorId, + outcome_id = outcomeId, + analysis_id = analysisId, + database_id = databaseId + ) + + + if (!is.null(databaseId)) { + result$databaseId <- NULL + } + + eq <- round(result$equipoise, 4) + + return(eq) +} + getCohortMethodPs <- function( connectionHandler, resultDatabaseSettings, @@ -157,7 +217,7 @@ getCohortMethodPs <- function( } # CohortMethod-propensityScoreDist -plotCohortMethodPs <- function(ps, targetName, comparatorName) { +plotCohortMethodPs <- function(ps, targetName, comparatorName, equipoiseStatistic) { if(is.null(ps$preferenceScore)){ return(NULL) } @@ -180,13 +240,17 @@ plotCohortMethodPs <- function(ps, targetName, comparatorName) { grDevices::rgb(0, 0, 0.8, alpha = 0.5))) + ggplot2::scale_x_continuous("Preference score", limits = c(0, 1)) + ggplot2::scale_y_continuous("Density") + + ggplot2::ggtitle(paste0("Equipoise Statistic = ", equipoiseStatistic)) + ggplot2::theme(legend.title = ggplot2::element_blank(), panel.grid.major = ggplot2::element_blank(), panel.grid.minor = ggplot2::element_blank(), legend.position = "top", legend.text = theme, axis.text = theme, - axis.title = theme) + axis.title = theme, + plot.title = ggplot2::element_text(vjust = -20) + ) + + ggplot2::guides(fill = ggplot2::guide_legend(nrow = 2)) if (!is.null(ps$databaseId)) { plot <- plot + ggplot2::facet_grid(databaseId~., switch = "both") + ggplot2::theme(legend.position = "right") diff --git a/R/estimation-cohort-method-systematicError.R b/R/estimation-cohort-method-systematicError.R index fa1ce54..b2fd49a 100644 --- a/R/estimation-cohort-method-systematicError.R +++ b/R/estimation-cohort-method-systematicError.R @@ -33,7 +33,8 @@ cohortMethodSystematicErrorViewer <- function(id) { shiny::div(shiny::strong("Figure 4."),"Systematic error. Effect size estimates for the negative controls (true hazard ratio = 1) and positive controls (true hazard ratio > 1), before and after calibration. Estimates below the diagonal dashed lines are statistically significant (alpha = 0.05) different from the true effect size. A well-calibrated - estimator should have the true effect size within the 95 percent confidence interval 95 percent of times."), + estimator should have the true effect size within the 95 percent confidence interval 95 percent of times. + The expected absolute systematic error (EASE) statistic is also shown at the top of the figure."), shiny::div(style = "display: inline-block;vertical-align: top;margin-bottom: 10px;", shiny::downloadButton(outputId = ns("downloadSystematicErrorPlotPng"), label = "Download plot as PNG"), @@ -82,6 +83,15 @@ cohortMethodSystematicErrorServer <- function( databaseId = row$databaseId ) + ease <- estimationGetEase( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + targetId = row$targetId, + comparatorId = row$comparatorId, + analysisId = row$analysisId, + databaseId = row$databaseId + ) + # remove the RR zeros that replace NAs during data upload controlResults$logRr[controlResults$logRr == 0] <- NA controlResults$ci95Lb[controlResults$ci95Lb == 0] <- NA @@ -90,7 +100,7 @@ cohortMethodSystematicErrorServer <- function( controlResults$calibratedCi95Lb[controlResults$calibratedCi95Lb == 0] <- NA controlResults$calibratedCi95Ub[controlResults$calibratedCi95Ub == 0] <- NA - plot <- plotCohortMethodScatter(controlResults) + plot <- plotCohortMethodScatter(controlResults, ease) return(plot) } }) @@ -99,8 +109,25 @@ cohortMethodSystematicErrorServer <- function( return(systematicErrorPlot()) }) + picName <- shiny::reactive({ + row <- selectedRow() + if (is.null(row)) { + return(NULL) + } else { + picName <- paste0("Target=", stringr::str_trunc(row$target, 35), "_", + "Comparator=",stringr::str_trunc(row$comparator, 35), "_", + "Analysis=",row$description, "_", + "DB=",row$cdmSourceAbbreviation, "_", + Sys.Date()) + } + + return(picName) + + }) + output$downloadSystematicErrorPlotPng <- shiny::downloadHandler( - filename = "SystematicError.png", + + filename = paste0("SystematicErrorPlot_", picName(), ".png"), contentType = "image/png", content = function(file) { ggplot2::ggsave(file, plot = systematicErrorPlot(), width = 12, height = 5.5, dpi = 400) @@ -108,7 +135,7 @@ cohortMethodSystematicErrorServer <- function( ) output$downloadSystematicErrorPlotPdf <- shiny::downloadHandler( - filename = "SystematicError.pdf", + filename = paste0("SystematicErrorPlot_", picName(), ".pdf"), contentType = "application/pdf", content = function(file) { ggplot2::ggsave(file = file, plot = systematicErrorPlot(), width = 12, height = 5.5) @@ -175,7 +202,7 @@ getCohortMethodControlResults <- function( } -plotCohortMethodScatter <- function(controlResults) { +plotCohortMethodScatter <- function(controlResults, ease = NULL) { if(nrow(controlResults)==0){ return(NULL) @@ -262,6 +289,7 @@ plotCohortMethodScatter <- function(controlResults) { labels = breaks) + ggplot2::scale_y_continuous("Standard Error", limits = c(0, 1)) + ggplot2::facet_grid(yGroup ~ Group) + + ggplot2::ggtitle(paste0("EASE Statistic = ", ease)) + ggplot2::theme(panel.grid.minor = ggplot2::element_blank(), panel.background = ggplot2::element_blank(), panel.grid.major = ggplot2::element_blank(), @@ -272,10 +300,60 @@ plotCohortMethodScatter <- function(controlResults) { legend.key = ggplot2::element_blank(), strip.text.x = theme, strip.text.y = theme, - strip.background = ggplot2::element_blank(), - legend.position = "none") + strip.background = ggplot2::element_blank() + # , + # legend.position = "top", + # legend.text = paste0("EASE = ", ease) + ) return(plot) } +estimationGetEase <- function( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + targetId = targetId, + comparatorId = comparatorId, + analysisId = analysisId, + databaseId = databaseId +){ + + sql <- " + SELECT DISTINCT + dmd.cdm_source_abbreviation database_name, + cmds.analysis_id, + cmds.target_id, + cmds.comparator_id, + cmds.max_sdm, + cmds.ease + FROM + @schema.@cm_table_prefixdiagnostics_summary cmds + INNER JOIN @schema.@database_table dmd ON dmd.database_id = cmds.database_id + + where cmds.target_id = @target_id + and cmds.comparator_id = @comparator_id + and cmds.analysis_id = @analysis_id + and cmds.database_id = '@database_id' + ; + " + + result <- connectionHandler$queryDb( + sql = sql, + schema = resultDatabaseSettings$schema, + cm_table_prefix = resultDatabaseSettings$cmTablePrefix, + database_table = resultDatabaseSettings$databaseTable, + target_id = targetId, + comparator_id = comparatorId, + analysis_id = analysisId, + database_id = databaseId + ) + + ease <- round(result$ease, 4) + + return( + ease + ) + +} + diff --git a/tests/testthat/Rplots.pdf b/tests/testthat/Rplots.pdf new file mode 100644 index 0000000..0caff5e Binary files /dev/null and b/tests/testthat/Rplots.pdf differ diff --git a/tests/testthat/test-estimation-cohort-method-power.R b/tests/testthat/test-estimation-cohort-method-power.R index a891e12..9c89c75 100644 --- a/tests/testthat/test-estimation-cohort-method-power.R +++ b/tests/testthat/test-estimation-cohort-method-power.R @@ -49,10 +49,10 @@ shiny::testServer( comparatorDays = 1000 ) ) - testthat::expect_true(!is.null(output$powerTable)) + testthat::expect_true(!is.null(powerTable)) testthat::expect_true(!is.null(output$powerTableCaption)) testthat::expect_true(!is.null(output$timeAtRiskTableCaption)) - testthat::expect_true(!is.null(output$timeAtRiskTable)) + testthat::expect_true(!is.null(timeAtRiskTable)) })