Skip to contents

Add cohort name for each cohort_definition_id

Usage

addCohortName(cohort)

Arguments

cohort

A cohort_table object.

Value

cohort with an extra column with the cohort names

Examples

# \donttest{
library(PatientProfiles)

cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
  addCohortName()
#> # A query:  ?? x 5
#> # Database: DuckDB 1.5.4 [unknown@Linux 6.17.0-1020-azure:R 4.6.1/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date cohort_name
#>                   <int>      <int> <date>            <date>          <chr>      
#>  1                    2          8 1964-03-31        1965-10-09      cohort_2   
#>  2                    2          6 1953-02-03        1954-05-28      cohort_2   
#>  3                    3          5 1964-01-28        1966-10-13      cohort_3   
#>  4                    3          2 1961-02-19        1972-03-05      cohort_3   
#>  5                    1          4 1920-09-21        1931-12-07      cohort_1   
#>  6                    3          9 1952-06-27        1952-06-30      cohort_3   
#>  7                    1          7 1919-07-16        1921-06-10      cohort_1   
#>  8                    1          1 1989-09-08        1992-09-04      cohort_1   
#>  9                    3         10 1986-03-16        1997-03-15      cohort_3   
#> 10                    3          3 1969-09-11        1972-11-11      cohort_3   
# }