View source: R/hypertensionMedication.R
hypertensionMedication | R Documentation |
This function attempts to define presence of hypertension based on the use of at least two drugs for hypertension. The basis for the function is a validation study performed in relation to Olesen et al. (BMJ 2011;342:d124) where the sensitivity was 80.0 defined index date and using medication 180 days before that date. Not directly validated, this function can also calculate the date of start of hypertension as a date where an individual has picked up at least two classes of antihypertensive medication for two consecutive periods of 3 months.
Note: If there are repeats of ptid with separate index.date, then the presence of hypertension is evaluated for each date.
hypertensionMedication(data, vars=c("ptid","ATCcode",
"prescription.date"), index.date=NULL,medication.definition=hypertensionATC)
data |
- A data frame/table containing prescription data |
vars |
- names of variables containing person identification, ATC code and date of prescription, and in that order |
index.date |
- name of a variable in data containing a date where the question is whether hypertension was present prior to this date. This will usually require merging of that variable to the medication data. |
medication.definition |
- a named list of character vectors defining the first part of the ATC codes for classes of antihypertensive medication. The default version is shown in details. |
This function uses a list of named character vectors to define classes of antihypertensive medication. The default versionis
AntiAdrenerg: 'C02A','C02B','C02C'
Diuretic: 'C02DA','C03A','C03B','C03D','C03E','C03X','C02DA','C07B','C07C','C07D','C08G','C09BA','C09DA','C09XA52','C02L'
Vasodilator: 'C02DB','C02DD','C02DG'
BetaBlocker: 'C07A','C07B','C07C','C07D','C07F'
CalciumAntagonist: 'C07FB','C08','C08G','C09BB','C09DB'
ReninAngiotensinInhibitor; 'C09AA','C09BA','C09BB','C09CA','C09DA','C09DB','C09XA02','C09XA52'
A data.table with the following variables
ptid: The variable from input defining the individual
hypertension: if an index variable is presen then it is a 0/1 variable as to wheter hypertension is present. If there is no index.date it is the date of hypertension.
numDrugs: Number of drugs at time of hypertension or index.date
Christian Torp-Pedersen
findCondition
require(data.table)
dat <-data.table(
ATC=sample(c('C02A','C03A','C02DD','C07A','C07F','C09AA','C09BA'),100,
replace=TRUE),
EKSD=as.Date("2012-01-01")+(sample(1:600,100,replace=TRUE)),
ptid=1:10,
index=c(rep(as.Date("2013-06-01"),50),rep(as.Date("2013-06-02"),50)))
setkey(dat,"ptid")
# Hypertension with indexdate:
index <- hypertensionMedication(dat,vars=c("ptid","ATC","EKSD"),
index.date="index")
index
noindex <- hypertensionMedication(dat,vars=c("ptid","ATC","EKSD"))
noindex
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.