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{
library(PatientProfiles)

cdm <- mockPatientProfiles(source = "duckdb")

cdm$cohort1 |>
  addSexQuery()
#> # Source:   SQL [?? 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                    2          1 1931-12-10        1959-03-12      Male  
#>  2                    2          2 1929-10-03        1942-02-02      Male  
#>  3                    3          3 1946-12-19        1952-12-08      Male  
#>  4                    1          4 1943-03-31        1943-05-28      Female
#>  5                    2          5 1952-06-14        1957-10-17      Female
#>  6                    2          6 1945-08-27        1968-01-26      Male  
#>  7                    1          7 1941-01-15        1950-04-08      Female
#>  8                    3          8 1929-05-03        1946-09-28      Male  
#>  9                    1          9 1972-12-03        1977-01-08      Male  
#> 10                    2         10 1917-10-27        1918-07-02      Female

# }