addPriorObservationQuery: Query to add the number of days of prior observation in the...

View source: R/addDemographicsQuery.R

addPriorObservationQueryR Documentation

Query to add the number of days of prior observation in the current observation period at a certain date

Description

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

Usage

addPriorObservationQuery(
  x,
  indexDate = "cohort_start_date",
  priorObservationName = "prior_observation",
  priorObservationType = "days"
)

Arguments

x

Table with individuals in the cdm.

indexDate

Variable in x that contains the date to compute the demographics characteristics.

priorObservationName

Prior observation variable name.

priorObservationType

Whether to return a "date" or the number of "days".

Value

cohort table with added column containing prior observation of the individuals.

Examples


library(PatientProfiles)

cdm <- mockPatientProfiles(source = "duckdb")

cdm$cohort1 |>
  addPriorObservationQuery()



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