get_cases_controls: Get case and controls for a phenotype

get_cases_controlsR Documentation

Get case and controls for a phenotype

Description

Given a phenotype, a list of episode data and reference dates per individual, identify valid cases/controls and compute the time to event data for these individuals respectively. If no reference date is given then the date of first available event will be taken as reference date for each individual.

Usage

get_cases_controls(
  definitions,
  lst.data,
  df.data.settings,
  df_reference_date = NULL,
  include_secondary_recurrence = FALSE,
  vct.identifiers = NULL,
  verbose = TRUE,
  window_fu_days_mask = 0
)

Arguments

definitions

phenotype/trait specified in definition table (a row in the table)

lst.data

list of data table with all episode data

df.data.settings

data frame containing data settings

df_reference_date

dataframe where first column is the identifier and second column the reference dates

vct.identifiers

character vector listing the identifiers in the cohort. This is used to define controls if reference_date is not given

window_fu_days_mask

number of days that future events should not be counted. e.g. you could only count events after 10 days from the reference visit to avoid events related to the reference date.

Value

a list of 2 data tables : all events for valid cases and an event summary containing time to event information for these individuals.

Examples

get_cases_controls(definitions=dfDefinitions_processed_expanded %>% filter(TRAIT=="Nicm"), lst.data,df.data.settings,  reference_date=setNames(as.Date(as.character(dfukb$f.53.0.0),format="%Y-%m-%d"),dfukb$identifier))

niekverw/ukbpheno documentation built on Oct. 30, 2023, 9:17 p.m.