View source: R/addCohortIntersect.R
| addCohortIntersectField | R Documentation |
It creates a column with the field of a desired intersection
addCohortIntersectField(
x,
targetCohortTable,
field,
targetCohortId = NULL,
indexDate = "cohort_start_date",
censorDate = NULL,
targetDate = "cohort_start_date",
order = "first",
window = list(c(0, Inf)),
nameStyle = "{cohort_name}_{field}_{window_name}",
name = NULL
)
x |
Table with individuals in the cdm. |
targetCohortTable |
name of the cohort that we want to check for overlap. |
field |
Column of interest in the targetCohort. |
targetCohortId |
vector of cohort definition ids to include. |
indexDate |
Variable in x that contains the date to compute the intersection. |
censorDate |
whether to censor overlap events at a specific date or a column date of x. |
targetDate |
Date of interest in the other cohort table. Either cohort_start_date or cohort_end_date. |
order |
date to use if there are multiple records for an individual during the window of interest. Either first or last. |
window |
Window of time to identify records relative to the indexDate. Records outside of this time period will be ignored. |
nameStyle |
naming of the added column or columns, should include required parameters. |
name |
Name of the new table, if NULL a temporary table is returned. |
table with added columns with overlap information.
library(PatientProfiles)
library(dplyr)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort2 <- cdm$cohort2 |>
mutate(even = if_else(subject_id %% 2, "yes", "no")) |>
compute(name = "cohort2")
cdm$cohort1 |>
addCohortIntersectFlag(
targetCohortTable = "cohort2"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.