addInObservationQuery: Query to add a new column to indicate if a certain record is...

View source: R/addDemographicsQuery.R

addInObservationQueryR Documentation

Query to add a new column to indicate if a certain record is within the observation period

Description

Same as addInObservation(), except query is not computed to a table.

Usage

addInObservationQuery(
  x,
  indexDate = "cohort_start_date",
  window = c(0, 0),
  completeInterval = FALSE,
  nameStyle = "in_observation"
)

Arguments

x

Table with individuals in the cdm.

indexDate

Variable in x that contains the date to compute the observation flag.

window

window to consider events of.

completeInterval

If the individuals are in observation for the full window.

nameStyle

Name of the new columns to create, it must contain "window_name" if multiple windows are provided.

Value

cohort table with the added numeric column assessing observation (1 in observation, 0 not in observation).

Examples


library(PatientProfiles)

cdm <- mockPatientProfiles(source = "duckdb")

cdm$cohort1 |>
  addInObservationQuery()




PatientProfiles documentation built on Feb. 24, 2026, 5:10 p.m.