Skip to contents

Compute the sex of the individuals

Usage

addSex(x, sexName = "sex", missingSexValue = "None", name = NULL)

Arguments

x

A table containing individuals in a CDM reference.

sexName

Name of the sex column to add.

missingSexValue

Value to use when sex is missing.

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()
#> # A query:  ?? x 5
#> # Database: DuckDB 1.5.4 [unknown@Linux 6.17.0-1020-azure:R 4.6.1/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    1          1 1950-12-07        1959-10-05      Female
#>  2                    1          2 1994-08-26        1996-05-16      Male  
#>  3                    2          3 1933-02-10        1934-06-21      Male  
#>  4                    3          4 2005-08-21        2019-06-03      Male  
#>  5                    1          5 1977-02-18        1977-02-18      Male  
#>  6                    3          6 1976-09-25        1979-12-31      Male  
#>  7                    1          7 1968-01-23        1996-02-16      Female
#>  8                    1          8 1995-12-14        2005-11-14      Male  
#>  9                    1          9 1954-02-06        1961-12-22      Male  
#> 10                    3         10 1979-06-27        1986-08-13      Female

# }