
Summarise variables using a set of estimate functions. The output will be a formatted summarised_result object.
Source:R/summariseResult.R
summariseResult.Rd
Summarise variables using a set of estimate functions. The output will be a formatted summarised_result object.
Arguments
- table
Table with different records.
- group
List of groups to be considered.
- includeOverallGroup
TRUE or FALSE. If TRUE, results for an overall group will be reported when a list of groups has been specified.
- strata
List of the stratifications within each group to be considered.
- includeOverallStrata
TRUE or FALSE. If TRUE, results for an overall strata will be reported when a list of strata has been specified.
- variables
Variables to summarise, it can be a list to point to different set of estimate names.
- estimates
Estimates to obtain, it can be a list to point to different set of variables.
- counts
Whether to compute number of records and number of subjects.
- weights
Name of the column in the table that contains the weights to be used when measuring the estimates.
Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
x <- cdm$cohort1 |>
addDemographics()
result <- summariseResult(x)
#> ℹ The following estimates will be computed:
#> • cohort_start_date: min, q25, median, q75, max
#> • cohort_end_date: min, q25, median, q75, max
#> • age: min, q25, median, q75, max
#> • sex: count, percentage
#> • prior_observation: min, q25, median, q75, max
#> • future_observation: min, q25, median, q75, max
#> ! Table is collected to memory as not all requested estimates are supported on
#> the database side
#> → Start summary of data, at 2025-09-13 21:23:07.95746
#> ✔ Summary finished, at 2025-09-13 21:23:08.074126
result
#> # A tibble: 31 × 13
#> result_id cdm_name group_name group_level strata_name strata_level
#> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 1 PatientProfilesMock overall overall overall overall
#> 2 1 PatientProfilesMock overall overall overall overall
#> 3 1 PatientProfilesMock overall overall overall overall
#> 4 1 PatientProfilesMock overall overall overall overall
#> 5 1 PatientProfilesMock overall overall overall overall
#> 6 1 PatientProfilesMock overall overall overall overall
#> 7 1 PatientProfilesMock overall overall overall overall
#> 8 1 PatientProfilesMock overall overall overall overall
#> 9 1 PatientProfilesMock overall overall overall overall
#> 10 1 PatientProfilesMock overall overall overall overall
#> # ℹ 21 more rows
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> # estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> # additional_name <chr>, additional_level <chr>
# }