Summarise the number of people in observation during a specific interval of time.
Source:R/summariseInObservation.R
summariseInObservation.Rd
Summarise the number of people in observation during a specific interval of time.
Usage
summariseInObservation(
observationPeriod,
unit = "year",
unitInterval = 1,
output = "records",
ageGroup = NULL,
sex = FALSE
)
Arguments
- observationPeriod
An observation_period omop table. It must be part of a cdm_reference object.
- unit
Whether to stratify by "year" or by "month".
- unitInterval
Number of years or months to include within the time interval.
- output
Output format. It can be either the number of records ("records") that are in observation in the specific interval of time, the number of person-days ("person-days"), or both c("records","person-days").
- 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, warn.conflicts = FALSE)
cdm <- mockOmopSketch()
result <- summariseInObservation(
cdm$observation_period,
unit = "month",
unitInterval = 6,
output = c("person-days","records"),
ageGroup = list("<=60" = c(0,60), ">60" = c(61, Inf)),
sex = TRUE
)
result |>
glimpse()
#> Rows: 2,900
#> Columns: 13
#> $ result_id <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ cdm_name <chr> "mockOmopSketch", "mockOmopSketch", "mockOmopSketch",…
#> $ group_name <chr> "omop_table", "omop_table", "omop_table", "omop_table…
#> $ group_level <chr> "observation_period", "observation_period", "observat…
#> $ strata_name <chr> "sex &&& age_group", "sex", "sex", "sex &&& age_group…
#> $ strata_level <chr> "Male &&& <=60", "Male", "Male", "Male &&& <=60", "Ma…
#> $ variable_name <chr> "Number person-days", "Number person-days", "Number r…
#> $ variable_level <chr> "1954-07-01 to 1954-12-31", "1954-07-01 to 1954-12-31…
#> $ estimate_name <chr> "count", "count", "count", "count", "count", "count",…
#> $ estimate_type <chr> "integer", "integer", "integer", "integer", "integer"…
#> $ estimate_value <chr> "176", "176", "1", "1", "181", "181", "1", "1", "96",…
#> $ additional_name <chr> "overall", "overall", "overall", "overall", "overall"…
#> $ additional_level <chr> "overall", "overall", "overall", "overall", "overall"…
PatientProfiles::mockDisconnect(cdm)
# }