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,
type = "auto"
)
x |
A table containing individuals in a CDM reference. |
targetCohortTable |
Name of the cohort table to intersect with. |
field |
Name or names of columns in the target tables to add to |
targetCohortId |
Cohort definition IDs to include from
|
indexDate |
Name of a date column in |
censorDate |
Date or name of a date column in |
targetDate |
Name or names of date columns in the target tables to use for the intersection. |
order |
Which record to use when multiple records occur in a window:
|
window |
Window or windows of time relative to |
nameStyle |
Naming pattern for the added column or columns. It should
include the required formatting variables. If more than one |
name |
Name of the new table. If |
type |
Type of the created column(s). Counts, days, age, and observation
durations can be |
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.