Skip to contents

Compute the sex of the individuals

Usage

addSex(x, sexName = "sex", missingSexValue = "None", name = NULL)

Arguments

x

Table with individuals in the cdm.

sexName

name of the new column to be added.

missingSexValue

Value to include if missing sex.

name

Name of the new table, if NULL a temporary table is returned.

Value

table x with the added column with sex information.

Examples

# \donttest{
cdm <- mockPatientProfiles()

cdm$cohort1 |>
  addSex()
#> # Source:   table<og_133_1734615535> [?? 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 sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    1          1 1977-03-19        1995-01-21      Male  
#>  2                    1          2 1957-05-17        1961-07-10      Male  
#>  3                    3          3 1913-05-16        1919-06-20      Male  
#>  4                    2          4 1993-06-03        1994-04-13      Female
#>  5                    3          5 1975-03-20        1975-10-08      Female
#>  6                    2          6 1993-01-05        1993-06-19      Female
#>  7                    3          7 1923-03-19        1923-08-07      Male  
#>  8                    2          8 1983-06-26        1985-04-18      Female
#>  9                    2          9 1921-12-31        1934-11-18      Female
#> 10                    3         10 1988-03-05        2011-12-10      Male  

mockDisconnect(cdm = cdm)
# }