Create a summarise result object to summarise record counts of an omop_table using a specific time interval. Only records that fall within the observation period are counted.
Source:R/summariseRecordCount.R
summariseRecordCount.Rd
Create a summarise result object to summarise record counts of an omop_table using a specific time interval. Only records that fall within the observation period are counted.
Usage
summariseRecordCount(
cdm,
omopTableName,
unit = "year",
unitInterval = 1,
ageGroup = NULL,
sex = FALSE
)
Arguments
- cdm
A cdm object.
- omopTableName
A character vector of omop tables from the cdm.
- unit
Whether to stratify by "year" or by "month".
- unitInterval
An integer. Number of years or months to include within the same interval.
- ageGroup
A list of age groups to stratify results by.
- sex
Boolean variable. Whether to stratify by sex (TRUE) or not (FALSE).
Examples
# \donttest{
library(dplyr)
library(OmopSketch)
# Connect to a mock database
cdm <- mockOmopSketch()
# Run summarise clinical tables
summarisedResult <- summariseRecordCount(cdm = cdm,
omopTableName = "condition_occurrence",
unit = "year",
unitInterval = 10,
ageGroup = list("<=20" = c(0,20), ">20" = c(21, Inf)),
sex = TRUE)
summarisedResult |> print()
#> # A tibble: 57 × 13
#> result_id cdm_name group_name group_level strata_name strata_level
#> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 1 mockOmopSketch omop_table condition_occur… age_group … <=20 &&& Fe…
#> 2 1 mockOmopSketch omop_table condition_occur… age_group … <=20 &&& Ma…
#> 3 1 mockOmopSketch omop_table condition_occur… age_group … >20 &&& Fem…
#> 4 1 mockOmopSketch omop_table condition_occur… age_group … >20 &&& Male
#> 5 1 mockOmopSketch omop_table condition_occur… age_group … <=20 &&& Fe…
#> 6 1 mockOmopSketch omop_table condition_occur… age_group … <=20 &&& Ma…
#> 7 1 mockOmopSketch omop_table condition_occur… age_group … >20 &&& Fem…
#> 8 1 mockOmopSketch omop_table condition_occur… age_group … >20 &&& Male
#> 9 1 mockOmopSketch omop_table condition_occur… age_group … <=20 &&& Ma…
#> 10 1 mockOmopSketch omop_table condition_occur… age_group … <=20 &&& Fe…
#> # ℹ 47 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>
# }