Learn R Programming

OmopSketch (version 1.0.0)

summariseObservationPeriod: Summarise the observation period table getting some overall statistics in a summarised_result object

Description

Summarise the observation period table getting some overall statistics in a summarised_result object

Usage

summariseObservationPeriod(
  cdm,
  estimates = c("mean", "sd", "min", "q05", "q25", "median", "q75", "q95", "max",
    "density"),
  missingData = TRUE,
  quality = TRUE,
  byOrdinal = TRUE,
  ageGroup = NULL,
  sex = FALSE,
  dateRange = NULL,
  observationPeriod = lifecycle::deprecated()
)

Value

A summarised_result object with the results.

Arguments

cdm

A cdm_reference object. Use CDMConnector to create a reference to a database or omock to create a reference to synthetic data.

estimates

Estimates to summarise the variables of interest ( Records per person, Duration in days and Days to next observation period).

missingData

Logical. If TRUE, includes a summary of missing data for relevant fields.

quality

Logical. If TRUE, performs basic data quality checks, including:

  • Number of subjects not included in person table.

  • Number of records with end date before start date.

  • Number of records with start date before the person's birth date.

byOrdinal

Boolean variable. Whether to stratify by the ordinal observation period (e.g., 1st, 2nd, etc.) (TRUE) or simply analyze overall data (FALSE)

ageGroup

A list of age groups to stratify the results by. Each element represents a specific age range. You can give them specific names, e.g. ageGroup = list(children = c(0, 17), adult = c(18, Inf)).

sex

Logical; whether to stratify results by sex (TRUE) or not (FALSE).

dateRange

A vector of two dates defining the desired study period. Only the start_date column of the OMOP table is checked to ensure it falls within this range. If dateRange is NULL, no restriction is applied.

observationPeriod

deprecated.

Examples

Run this code
# \donttest{
library(OmopSketch)
library(dplyr, warn.conflicts = FALSE)
library(omock)

cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb")

result <- summariseObservationPeriod(cdm = cdm)

tableObservationPeriod(result = result)

plotObservationPeriod(
  result = result,
  variableName = "Duration in days",
  plotType = "boxplot"
)

cdmDisconnect(cdm = cdm)
# }

Run the code above in your browser using DataLab