When using addCohortIntersectCount() with a cohort that has an extra column (in the example below, the extra column is year_of_birth), the following warning appears:
> Warning: The following columns will be overwritten: year_of_birth
However, it does not happen with the extra column date_of_birth.
library(DrugUtilisation)
#> Warning: package 'DrugUtilisation' was built under R version 4.3.3
library(PatientProfiles)
#> Warning: package 'PatientProfiles' was built under R version 4.3.3
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
cdm <- mockDrugUtilisation()
cdm[["cohort1"]] |>
addDateOfBirth() |>
mutate(year_of_birth = year(date_of_birth)) |>
addCohortIntersectCount(targetCohortTable = "cohort2")
#> Warning: The following columns will be overwritten: year_of_birth
#> # Source: table<og_011_1714683955> [10 x 9]
#> # Database: DuckDB v0.9.2 [martaa@Windows 10 x64:R 4.3.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 1 2020-09-20 2021-03-18
#> 2 3 2 2022-05-21 2022-06-05
#> 3 3 6 1991-05-25 1992-04-18
#> 4 1 7 2015-09-10 2018-05-02
#> 5 3 8 2012-02-04 2012-02-15
#> 6 2 9 2022-10-05 2022-11-12
#> 7 1 10 1997-11-07 2003-08-04
#> 8 2 3 2010-02-10 2010-07-21
#> 9 1 4 2022-01-26 2022-04-28
#> 10 3 5 2019-07-17 2019-12-26
#> # ℹ 5 more variables: date_of_birth <date>, year_of_birth <dbl>,
#> # cohort_3_0_to_inf <dbl>, cohort_1_0_to_inf <dbl>, cohort_2_0_to_inf <dbl>
When using
addCohortIntersectCount()
with a cohort that has an extra column (in the example below, the extra column is year_of_birth), the following warning appears:> Warning: The following columns will be overwritten: year_of_birth
However, it does not happen with the extra column date_of_birth.
Created on 2024-05-02 with reprex v2.1.0