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_117_1750280301> [?? x 5]
#> # Database: DuckDB v1.3.0 [unknown@Linux 6.11.0-1015-azure:R 4.5.1/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    3          1 1972-04-02        1977-09-24      Male  
#>  2                    2          2 1991-01-13        1996-05-09      Male  
#>  3                    2          3 1964-12-11        1966-11-15      Male  
#>  4                    2          4 1928-04-30        1948-10-03      Female
#>  5                    3          5 1965-08-16        1970-01-25      Female
#>  6                    2          6 1926-08-28        1950-12-13      Male  
#>  7                    1          7 1954-02-12        1960-10-05      Male  
#>  8                    1          8 1987-03-29        2004-01-17      Female
#>  9                    3          9 1932-01-06        1933-02-01      Male  
#> 10                    3         10 1997-09-26        1999-03-29      Male  

mockDisconnect(cdm = cdm)
# }