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",
  type = "numeric"
)

Arguments

x

A table containing individuals in a CDM reference.

indexDate

Name of a date column in x, or a single date to use for all rows, used as the reference date.

window

Window or windows of time relative to indexDate to consider.

completeInterval

If TRUE, individuals must be observed for the full requested interval.

nameStyle

Naming pattern for the added column or columns. It should include the required formatting variables. If more than one tableName is provided, it must include {table_name}.

type

Type of the created column(s). Counts, days, age, and observation durations can be "numeric" or "integer". Flag columns can also be "logical". Field columns can use "auto" to preserve the source type, or can be converted to "numeric", "integer", "logical", or "character".

Value

Cohort table with an added column assessing observation. Values are 1/TRUE in observation and 0/FALSE otherwise, according to type.

Examples


library(PatientProfiles)

cdm <- mockPatientProfiles(source = "duckdb")

cdm$cohort1 |>
  addInObservationQuery()




PatientProfiles documentation built on Aug. 22, 2026, 1:07 a.m.