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.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    3          1 1942-07-01        1943-09-09      Male  
#>  2                    1          2 1914-07-19        1930-06-17      Male  
#>  3                    3          3 1947-02-06        1965-07-28      Male  
#>  4                    2          4 1989-09-05        2008-12-12      Male  
#>  5                    1          5 1976-10-10        1981-04-21      Male  
#>  6                    3          6 1991-11-20        1999-10-16      Female
#>  7                    2          7 1941-02-28        1942-08-11      Male  
#>  8                    1          8 1949-05-10        1950-02-06      Male  
#>  9                    3          9 1931-09-17        1931-09-17      Male  
#> 10                    1         10 1936-10-29        1942-05-20      Female

mockDisconnect(cdm = cdm)
# }