
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_117_1740755713> [?? x 5]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 1 1984-06-10 1993-09-15
#> 2 2 2 1957-09-04 1965-05-17
#> 3 2 3 1933-04-30 1937-10-10
#> 4 1 4 1973-09-27 1979-04-13
#> 5 2 5 2007-12-31 2008-01-01
#> 6 2 6 1980-07-14 1983-04-04
#> 7 2 7 1918-04-16 1918-11-19
#> 8 1 8 1959-03-17 1969-01-17
#> 9 1 9 1984-01-06 2000-10-31
#> 10 2 10 1944-01-15 1958-10-02
#> # ℹ 1 more variable: future_observation <int>
mockDisconnect(cdm = cdm)
# }