convert_touchscreen_to_episodedata: Convert self-reported illness codes from touchscreen with...

View source: R/convert_touchscreen_to_episodedata.r

convert_touchscreen_to_episodedataR Documentation

Convert self-reported illness codes from touchscreen with optionally corresponding time of diagnosis to episodes format

Description

This function takes data fields containing illness codes/time of diagnosis distributed in multiple with each row representing one individual. It processed the data and return in episodes of event for all individuals

Usage

convert_touchscreen_to_episodedata(
  df,
  ts_conditions = dfDefinitions_processed$TS,
  qc_treshold_year = 10,
  event_code = 2
)

Arguments

df

dataframe containing the fields

ts_conditions

touchscreen data fields for illness codes, each followed by the data field for corresponding time of diagnosis in square brackets

event_code

code number to indicate if the episodes is a true event 1, self-reported/interpolated event 2 , for which a mean date is taken as event date in case of multiple occurence, or non-event 0 , for which date does not correspond to occurence of illness code. These codes are used in time-to-event analysis, default: 2

qc_threshold_year

in case of multiple episodes for same illness code, if time difference is larger than qc threshold between the oldest and newest episodes, eventdate will be discarded i.e. set to NA, default:10

Value

a data.table object with all episodes

Examples

convert_touchscreen_to_episodedata(dfukb,ts_conditions = "6150[3894]")
convert_touchscreen_to_episodedata(dfukb,ts_conditions = dfDefinitions_processed$TS)

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