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.1.3 [unknown@Linux 6.8.0-1017-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                    2          1 1914-08-15        1930-02-14      cohort_2   
#>  2                    2          7 1972-04-26        1990-01-12      cohort_2   
#>  3                    2          8 1905-12-16        1911-08-26      cohort_2   
#>  4                    2         10 1988-09-28        1988-10-03      cohort_2   
#>  5                    3          5 1957-02-18        1959-10-28      cohort_3   
#>  6                    2          4 1964-04-23        1966-07-15      cohort_2   
#>  7                    1          2 1986-11-02        1987-08-24      cohort_1   
#>  8                    2          3 1923-03-21        1923-06-06      cohort_2   
#>  9                    2          6 1967-01-04        1970-09-09      cohort_2   
#> 10                    3          9 1934-01-15        1937-01-05      cohort_3   
# }