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{
library(PatientProfiles)

cdm <- mockPatientProfiles(source = "duckdb")

cdm$cohort1 |>
  addSex()
#> # Source:   table<og_127_1761733709> [?? x 5]
#> # Database: DuckDB 1.4.1 [unknown@Linux 6.11.0-1018-azure:R 4.5.1/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    2          1 1964-06-12        1976-02-29      Female
#>  2                    2          2 1946-04-08        1953-07-05      Female
#>  3                    3          3 1981-07-25        1984-01-12      Male  
#>  4                    2          4 1941-08-05        1941-11-05      Male  
#>  5                    3          5 1934-11-02        1953-07-31      Female
#>  6                    3          6 1935-02-02        1985-02-05      Female
#>  7                    2          7 1985-05-09        1986-12-31      Male  
#>  8                    2          8 1944-09-02        1961-02-05      Male  
#>  9                    2          9 1932-03-13        1939-03-31      Male  
#> 10                    3         10 1993-02-24        1993-08-30      Male  

# }