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

Sex variable name.

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_140_1775495330> [?? x 5]
#> # Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    3          1 1935-11-08        1936-01-01      Female
#>  2                    1          2 1965-04-13        1968-04-13      Female
#>  3                    2          3 1950-11-26        1951-12-12      Female
#>  4                    2          4 1986-04-19        1997-07-09      Female
#>  5                    2          5 1972-12-17        1975-04-10      Female
#>  6                    2          6 1911-12-16        1914-05-28      Female
#>  7                    2          7 1979-07-14        1985-07-17      Male  
#>  8                    3          8 1957-01-08        1958-05-19      Female
#>  9                    2          9 1979-12-29        1984-10-20      Male  
#> 10                    2         10 2008-04-27        2009-08-06      Female

# }