Skip to contents

Create a summarised result with 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

observation_period omop table.

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).

Value

A summarised_result object.

Examples

if (FALSE) { # \dontrun{
library(OmopSketch)
library(dplyr)

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 |>
  dplyr::glimpse()

PatientProfiles::mockDisconnect(cdm)
} # }