library(PatientProfiles)
cdm <- mockPatientProfiles()
cdm$cohort1 |> dplyr::mutate(sex = NA_character_) |> summariseResult(strata = c("sex"))
#> ℹ The following estimates will be computed:
#> • cohort_start_date: min, q25, median, q75, max
#> • cohort_end_date: min, q25, median, q75, max
#> • sex: min, q25, median, q75, max, count, percentage
#> ! Table is collected to memory as not all requested estimates are supported on
#> the database side
#> → Start summary of data, at 2024-05-12 20:37:43
#> Warning: There were 2 warnings in `dplyr::summarise()`.
#> The first warning was:
#> ℹ In argument: `dplyr::across(...)`.
#> ℹ In group 1: `strata_id = 1`.
#> Caused by warning in `base::min()`:
#> ! no non-missing arguments to min; returning Inf
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> There were 2 warnings in `dplyr::summarise()`.
#> The first warning was:
#> ℹ In argument: `dplyr::across(...)`.
#> ℹ In group 1: `strata_id = 1`.
#> Caused by warning in `base::min()`:
#> ! no non-missing arguments to min; returning Inf
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> ✔ Summary finished, at 2024-05-12 20:37:44
#> Error in `checkGroupCount()`:
#> ! Each groupping (unique combination of: group_name, group_level,
#> strata_name, and strata_level) can not contain repeated group identifiers
#> (number subjects and number records).
#> First 2 combinations:
#> • 2 'number subjects' in variable_name for: group_name: overall, group_level:
#> overall, strata_name: overall, strata_level: overall.
#> • 2 'number records' in variable_name for: group_name: overall, group_level:
#> overall, strata_name: overall, strata_level: overall.
#> Backtrace:
#> ▆
#> 1. └─PatientProfiles::summariseResult(...)
#> 2. └─omopgenerics::newSummarisedResult(...) at PatientProfiles/R/summariseResult.R:195:2
#> 3. └─omopgenerics:::validateSummariseResult(x)
#> 4. └─omopgenerics:::checkGroupCount(x)
#> 5. └─cli::cli_abort(res)
#> 6. └─rlang::abort(...)
Created on 2024-05-12 with reprex v2.0.2