Skip to contents

Summarise variables using a set of estimate functions. The output will be a formatted summarised_result object.

Usage

summariseResult(
  table,
  group = list(),
  includeOverallGroup = FALSE,
  strata = list(),
  includeOverallStrata = TRUE,
  variables = NULL,
  estimates = c("min", "q25", "median", "q75", "max", "count", "percentage"),
  counts = TRUE
)

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.

Value

A summarised_result object with the summarised data of interest.

Examples

# \donttest{
library(PatientProfiles)
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

cdm <- mockPatientProfiles()
x <- cdm$cohort1 |>
  addDemographics() |>
  collect()
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 2024-12-19 13:11:11.216003
#>  Summary finished, at 2024-12-19 13:11:11.291331
mockDisconnect(cdm = cdm)
# }