CreateUKBiobankPhentoypes: CreateUKBiobankPhentoypes - Function

Description Usage Arguments References Examples

View source: R/main-function.r

Description

CreateUKBiobankPhentoypes creates dichotomous phenotypes for UK Biobank using definitions that are based on the available variables (e.g. HES-data, mortality, toucschreen, SR data). The current output includes variables on history, study visit, future, time-to-first-event; WORK IN PROGRESS

Usage

1
2
3
CreateUKBiobankPhentoypes(Nvisits, visitreference, UKbioDataset,
  dfmaster_SQL_merge, dfgpclinical, dfgpscripts, dfDefinitions, Outputdir,
  VctOutputIndividualColumns = c())

Arguments

Nvisits

#Number of follow-up visits in your dataset (a.t.m 3, baseline,1 and 2) .

visitreference

#Number visit that should be used as reference; should be 0 (baseline),1 or 2

dfmaster_SQL_merge

Dataframe: The Hesin table of UKBiobank that can be obtained by SQL; load via (WORK IN PROGRESS)

Outputdir

Output directory

VctOutputIndividualColumns

set VctOutputIndividualColumns=c("TS","SR","TS_RX","SR_RX","LAB") to output all individual columns, default is 'VctOutputIndividualColumns=c()'

dfUKbioDataset

Dataframe:The main UKBiobank dataset, currently only STATA files are allowed that are processed using the ukb_conv tool. Load with as.data.frame(read.dta13(file,convert.dates = TRUE,convert.factors=FALSE))

dfTraitTable

Dataframe: A Trait-definition table. (EXAMPLE: WORK IN PROGRESS)

References

<Please contact mail@niekverweij.com, this package is not yet ready to be distributed.>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
library(gdata)
library(readstata13)
library(CreateUKBiobankPhentoypes)
Nvisits=3
visitreference=0

Outputdir<-getwd()
dfUKbioDataset<-as.data.frame(read.dta13("/path/to/UKbioDataset_file.dta",convert.dates = TRUE,convert.factors=FALSE))

hesin_file="/path/to/hesin-4july2016.tsv"
hesin_diagicd10_file="/path/to/hesin_diagicd10-4july2016.tsv"
hesin_diagicd9_file="/path/to/hesin_diagicd9_22_03_2016.tsv"
hesin_oper_file="/path/to/hesin_oper-4july2016.tsv"
dfhesintables<-LoadHesinTable(dfUKbioDataset,hesin_file,hesin_diagicd10_file,hesin_diagicd9_file,hesin_oper_file)

## load phenotype definitions.
data(dfDefinitions)




#run with minimum variables:
CreateUKBiobankPhentoypes(Nvisits,visitreference,UKbioDataset,dfhesintables,dfDefinitions,Outputdir)
#which is the same as:
CreateUKBiobankPhentoypes(Nvisits,visitreference,UKbioDataset,dfhesintables,dfDefinitions,Outputdir,VctOutputIndividualColumns=c(),VctAllUKBVDefinitionColumns=c("TS","SR","TS_RX","SR_RX","LAB") )

#to output the variables based on RX (medication) in an *_RX file and exclude RX from the aggregate *_UKBV files run the following:
CreateUKBiobankPhentoypes(Nvisits,visitreference,UKbioDataset,dfhesintables,dfDefinitions,Outputdir,VctOutputIndividualColumns=c("SR_RX",VctAllUKBVDefinitionColumns=c("TS","SR","TS_RX","LAB") )

niekverw/ukpheno documentation built on May 4, 2020, 9:01 p.m.