
Compute the number of days till the end of the observation period at a certain date
Source:R/addDemographics.R
addFutureObservation.Rd
Compute the number of days till the end of the observation period at a certain date
Usage
addFutureObservation(
x,
indexDate = "cohort_start_date",
futureObservationName = "future_observation",
futureObservationType = "days",
name = NULL
)
Arguments
- x
Table with individuals in the cdm.
- indexDate
Variable in x that contains the date to compute the future observation.
- futureObservationName
name of the new column to be added.
- futureObservationType
Whether to return a "date" or the number of "days".
- name
Name of the new table, if NULL a temporary table is returned.
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addFutureObservation()
#> # Source: table<og_112_1748639772> [?? x 5]
#> # Database: DuckDB v1.2.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 1 1976-05-31 1976-08-26
#> 2 1 2 1946-10-19 1947-12-21
#> 3 3 3 1988-07-26 2010-01-27
#> 4 2 4 1964-07-04 1972-05-22
#> 5 1 5 1954-06-04 1954-06-26
#> 6 1 6 2005-08-11 2010-04-29
#> 7 2 7 1940-03-10 1950-09-11
#> 8 3 8 1963-09-24 1999-09-15
#> 9 3 9 1946-01-24 1955-03-18
#> 10 3 10 1985-01-09 1995-09-13
#> # ℹ 1 more variable: future_observation <int>
mockDisconnect(cdm = cdm)
# }