Skip to content

Commit

Permalink
Merge pull request #246 from oxford-pharmacoepi/min_cell_count
Browse files Browse the repository at this point in the history
remove problem arguments
  • Loading branch information
xihang-chen authored May 28, 2024
2 parents 032a4ca + 4ab8713 commit b0bd52a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
18 changes: 7 additions & 11 deletions R/displayTables.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
#' gt table or flextable. See visOmopResults package for more information on
#' how to define a style. Alternatively, use "default" to get visOmopResults
#' style, or NULL for gt/flextable default styling.
#' @param crude whether to report crude results.
#' @param adjusted whether to report adjusted results.
#' @param studyPopulation whether to report the study population.
#' @param indexName whether to report index names.
#' @param markerName whether to report marker names
#' @param cdmName whether to report database names.
#' @param .options named list with additional formatting options.
#' tableSequenceRatiosOptions() shows allowed arguments and
Expand All @@ -31,9 +27,9 @@
#' library(CohortSymmetry)
#' cdm <- mockCohortSymmetry()
#' cdm <- generateSequenceCohortSet(cdm = cdm,
#' indexTable = "cohort_1",
#' markerTable = "cohort_2",
#' name = "joined_cohort")
#' indexTable = "cohort_1",
#' markerTable = "cohort_2",
#' name = "joined_cohort")
#' res <- summariseSequenceRatios(cohort = cdm$joined_cohort)
#' gtResult <- tableSequenceRatios(res)
#' CDMConnector::cdmDisconnect(cdm = cdm)
Expand All @@ -46,14 +42,14 @@ tableSequenceRatios <- function(result,
c("N (%)" = "<count> (<percentage> %)",
"SR (CI)" = "<point_estimate> (<lower_CI> - <upper_CI>)"),
style = "default",
crude = TRUE,
adjusted = TRUE,
studyPopulation = TRUE,
indexName = TRUE,
markerName = TRUE,
cdmName = TRUE,
.options = NULL) {
# checks
crude <- T
adjusted <- T
indexName <- T
markerName <- T
checkSequenceSymmetry(result)
checksFormatSequenceSymmetry(type, crude, adjusted, studyPopulation, indexName,
markerName, cdmName, .options)
Expand Down
18 changes: 3 additions & 15 deletions man/tableSequenceRatios.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions tests/testthat/test-displayTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test_that("tableSequenceRatios - gt output", {
markerId = 3,
name = "joined_cohort")

res <- summariseSequenceRatios(cohort = cdm$joined_cohort)
res <- summariseSequenceRatios(cohort = cdm$joined_cohort, minCellCount = 0)

gtResult <- tableSequenceRatios(res)
expect_true("gt_tbl" %in% (gtResult %>% class()))
Expand All @@ -16,8 +16,9 @@ test_that("tableSequenceRatios - gt output", {
"Index first, N (%)", "Marker first, N (%)", "CSR (95% CI)",
"ASR (95% CI)")))
expect_no_error(gtResult <- tableSequenceRatios(res, studyPopulation = FALSE))
expect_no_error(gtResult <- tableSequenceRatios(res, cdmName = FALSE))
expect_true(all(colnames(gtResult$`_data`) %in%
c("Database name", "Index", "Marker",
c("Index", "Marker", "Study population",
"Index first, N (%)", "Marker first, N (%)", "CSR (95% CI)",
"ASR (95% CI)")))
CDMConnector::cdmDisconnect(cdm)
Expand All @@ -32,7 +33,7 @@ test_that("tableSequenceRatios - tibble output", {
markerId = 3,
name = "joined_cohort")

res <- summariseSequenceRatios(cohort = cdm$joined_cohort)
res <- summariseSequenceRatios(cohort = cdm$joined_cohort, minCellCount = 0)

tibble_res <- tableSequenceRatios(res, type = "tibble")

Expand All @@ -43,6 +44,8 @@ test_that("tableSequenceRatios - tibble output", {
"ASR (95% CI)")))
expect_no_error(tibble_res <- tableSequenceRatios(res, type = "tibble",
studyPopulation = FALSE))
expect_no_error(gtResult <- tableSequenceRatios(res, type = "tibble",
cdmName = FALSE))
CDMConnector::cdmDisconnect(cdm)
})

Expand All @@ -55,7 +58,7 @@ test_that("tableSequenceRatios - flextable output", {
markerId = 3,
name = "joined_cohort")

res <- summariseSequenceRatios(cohort = cdm$joined_cohort)
res <- summariseSequenceRatios(cohort = cdm$joined_cohort, minCellCount = 0)

flextable_res <- tableSequenceRatios(res, type = "flextable")

Expand All @@ -66,5 +69,7 @@ test_that("tableSequenceRatios - flextable output", {
"ASR (95% CI)")))
expect_no_error(flextable_res <- tableSequenceRatios(res, type = "flextable",
studyPopulation = FALSE))
expect_no_error(flextable_res <- tableSequenceRatios(res, type = "flextable",
cdmName = FALSE))
CDMConnector::cdmDisconnect(cdm)
})

0 comments on commit b0bd52a

Please sign in to comment.