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_122_1740755729> [?? x 5]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    2          1 1925-11-08        1948-08-15      Female
#>  2                    2          2 1929-01-10        1941-03-19      Female
#>  3                    1          3 1936-02-27        1956-09-14      Female
#>  4                    1          4 1916-04-28        1921-11-09      Female
#>  5                    1          5 1986-10-29        1988-06-01      Male  
#>  6                    3          6 1942-10-14        1943-06-15      Male  
#>  7                    1          7 1979-11-21        1982-06-16      Male  
#>  8                    2          8 1988-01-19        1988-08-22      Male  
#>  9                    2          9 1952-06-26        1969-04-17      Female
#> 10                    3         10 1970-07-19        1981-11-04      Male  

mockDisconnect(cdm = cdm)
# }