Skip to contents

Add cohort name for each cohort_definition_id

Usage

addCohortName(cohort)

Arguments

cohort

cohort to which add the cohort name

Value

cohort with an extra column with the cohort names

Examples

# \donttest{
library(PatientProfiles)

cdm <- mockPatientProfiles()
cdm$cohort1 |>
  addCohortName()
#> # Source:   SQL [?? 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 cohort_name
#>                   <int>      <int> <date>            <date>          <chr>      
#>  1                    3          3 1972-03-18        1972-04-18      cohort_3   
#>  2                    2          7 1996-07-22        1997-06-05      cohort_2   
#>  3                    1          8 1927-06-24        1928-09-10      cohort_1   
#>  4                    3          5 1921-03-17        1921-04-12      cohort_3   
#>  5                    2          1 1932-03-29        1939-02-02      cohort_2   
#>  6                    1          2 1975-08-01        1975-12-01      cohort_1   
#>  7                    3          9 2005-12-10        2014-01-14      cohort_3   
#>  8                    2          6 1917-11-27        1941-04-10      cohort_2   
#>  9                    2         10 1934-09-23        1937-05-02      cohort_2   
#> 10                    1          4 1996-06-10        2005-01-17      cohort_1   
# }