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.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date cohort_name
#>                   <int>      <int> <date>            <date>          <chr>      
#>  1                    1          7 1982-04-26        1993-01-14      cohort_1   
#>  2                    2          5 1954-03-18        1963-05-20      cohort_2   
#>  3                    1          9 1988-10-30        1988-12-30      cohort_1   
#>  4                    1          6 1987-04-10        1987-12-04      cohort_1   
#>  5                    3          1 1956-03-09        1968-07-25      cohort_3   
#>  6                    1         10 1940-05-12        1940-08-28      cohort_1   
#>  7                    3          8 1959-01-01        1962-08-12      cohort_3   
#>  8                    3          4 1934-05-20        1934-06-06      cohort_3   
#>  9                    3          3 1909-10-24        1923-02-23      cohort_3   
#> 10                    3          2 1979-10-04        1981-07-26      cohort_3   
# }