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.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#>    cohort_definition_id subject_id cohort_start_date cohort_end_date sex   
#>                   <int>      <int> <date>            <date>          <chr> 
#>  1                    1          1 1937-01-27        1953-10-11      Male  
#>  2                    1          2 1944-05-04        1945-01-17      Female
#>  3                    2          3 1950-10-12        1955-04-13      Male  
#>  4                    2          4 1912-06-27        1917-01-18      Male  
#>  5                    2          5 1965-05-31        1966-01-05      Female
#>  6                    3          6 1975-12-15        1976-01-29      Male  
#>  7                    1          7 1917-10-15        1922-01-21      Male  
#>  8                    1          8 1976-09-04        1993-08-30      Female
#>  9                    1          9 1977-03-17        1985-07-17      Male  
#> 10                    3         10 1966-03-02        1977-01-16      Male  

mockDisconnect(cdm = cdm)
# }