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_119_1757798563> [?? x 5]
#> # Database: DuckDB 1.3.3-dev231 [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                    3          1 1916-05-24        1926-01-08      Male  
#>  2                    3          2 2002-07-26        2002-11-04      Male  
#>  3                    2          3 1933-08-16        1961-11-14      Female
#>  4                    3          4 1917-08-13        1919-09-12      Female
#>  5                    1          5 1954-09-18        1968-09-06      Female
#>  6                    3          6 1959-12-18        1965-03-24      Female
#>  7                    1          7 1995-10-07        1998-11-15      Male  
#>  8                    1          8 1910-03-22        1938-11-14      Male  
#>  9                    3          9 1969-09-19        1989-08-05      Male  
#> 10                    2         10 1971-05-10        1971-11-18      Female

# }