Skip to contents

`r lifecycle::badge("experimental")` Same as `addSex()`, except query is not computed to a table.

Usage

addSexQuery(x, sexName = "sex", missingSexValue = "None")

Arguments

x

Table with individuals in the cdm.

sexName

name of the new column to be added.

missingSexValue

Value to include if missing sex.

Value

table x with the added column with sex information.

Examples

# \donttest{
cdm <- mockPatientProfiles()

cdm$cohort1 |>
  addSexQuery()
#> # Source:   SQL [?? 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                    1          1 1951-09-08        1956-07-25      Female
#>  2                    3          2 1960-11-23        1962-07-22      Male  
#>  3                    1          3 1989-12-03        2014-02-28      Female
#>  4                    2          4 1977-03-15        2000-06-30      Female
#>  5                    1          5 1955-04-12        1962-09-05      Female
#>  6                    2          6 1964-04-25        1980-06-05      Male  
#>  7                    1          7 2009-05-24        2014-03-09      Female
#>  8                    2          8 1940-02-22        1946-07-21      Male  
#>  9                    1          9 1953-10-27        1954-01-26      Male  
#> 10                    2         10 1985-09-13        1988-05-23      Female

mockDisconnect(cdm = cdm)
# }