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.4.1 [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                    3          1 1927-04-07        1966-05-15      Female
#>  2                    3          2 1930-04-03        1932-10-24      Male  
#>  3                    1          3 1937-12-14        1939-08-21      Male  
#>  4                    3          4 1917-10-13        1920-07-15      Female
#>  5                    1          5 1959-02-27        1960-06-29      Female
#>  6                    2          6 1940-04-23        1962-07-06      Female
#>  7                    1          7 1969-04-10        1976-06-05      Male  
#>  8                    2          8 1949-12-03        1955-03-21      Female
#>  9                    2          9 1998-08-17        1998-10-26      Female
#> 10                    3         10 1956-11-20        1960-03-26      Female

# }