get_incidence_prevalence: Get data for phenotype incidence and prevalence

View source: R/process_event_tables.r

get_incidence_prevalenceR Documentation

Get data for phenotype incidence and prevalence

Description

Given a data.table with all events for a phenotype and reference dates per individual, compute the time to event data for each individual. If no reference date is given then the date of first available event will be taken as reference date for each individual. ...

Usage

get_incidence_prevalence(
  all_event_dt,
  df.data.settings,
  df_reference_date = NULL,
  include_secondary_recurrence = FALSE,
  window_ref_days_include = 0,
  window_fu_days_mask = 0,
  verbose = TRUE
)

Arguments

all_event_dt

data table containing all events

df.data.settings

data frame containing data settings

window_ref_days_include

number of days around the reference date (visit) that should be used to indicates if individuals had the event on the reference date. Relevant if you want to know if participant took medication on the visit

window_fu_days_mask

number of days that future events should not be counted

reference_date

reference dates for each individuals in the whole cohort as a named vector

Value

a data table with individual with time to event information

Examples

all_event_dt <- get_all_events(dfDefinitions_processed_expanded[1,],lst.data,df.data.settings)
get_incidence_prevalence(all_event_dt,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.