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 [10 x 5]
#> # Database: DuckDB v0.10.2 [unknown@Linux 6.5.0-1021-azure:R 4.4.0/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date cohort_name
#>                   <int>      <int> <date>            <date>          <chr>      
#>  1                    2          2 2024-03-08        2034-12-08      cohort_2   
#>  2                    2          6 2070-02-15        2142-02-13      cohort_2   
#>  3                    2          9 2106-04-19        2107-07-13      cohort_2   
#>  4                    1          3 1982-09-16        2044-12-28      cohort_1   
#>  5                    2          4 2066-06-09        2114-12-25      cohort_2   
#>  6                    1          8 2078-01-21        2120-12-12      cohort_1   
#>  7                    3          1 2094-02-06        2099-01-14      cohort_3   
#>  8                    2          7 1949-09-26        1978-12-09      cohort_2   
#>  9                    2          5 2008-07-26        2047-01-08      cohort_2   
#> 10                    3         10 1955-06-05        1974-02-05      cohort_3   
# }