medicinMacro: Medicin macro to estimate prescription lengths and averages

Description Usage Arguments Author(s) Examples

View source: R/medicinMacro.R

Description

Processing function, to perform calculations according to the data and variables specified in preprocessing object.

Usage

1
2
3
4
medicinMacro(drugs, treatments = NULL, drugdb, admdb,
  drugdb.datevar = "eksd", admdb.datevars = c("inddto", "uddto"),
  id = "pnr", strength.var = "strnum", packsize.var = "packsize",
  apk.var = "apk", collapse = TRUE, splitting = FALSE)

Arguments

drugs

List of drugs (see examples).

treatments

If specified, calcations will only be performed for these treatments.

drugdb

data.table with (subset of) medical drugs registry

admdb

data.table with (subset of) hospital admission registry

drugdb.datevar

name of the date variable in drugdb. Default is "eksd".

admdb.datevars

names of the date variables in admdb. Default is c("inddto","uddto").

id

Name of variable to identify individuals. Default is "pnr".

strength.var

Name of variable to identify strength. Default is "strnum".

packsize.var

Name of variable to identify size of packages. Default is "packsize".

apk.var

Name of variable to identify number of packages. Default is "packsize".

collapse

Logical. If TRUE, collapse contiguous exposure periods with same computed exposure strength to one and add periods with zero exposure.

splitting

Split the data into 10 chunks to estimate remaining time (and possibly speed up computation).

Author(s)

Helene Charlotte Rytgaard, Anders Munch and Thomas Alexander Gerds based on the famous SAS macro by Christian Tobias Torp-Pedersen

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
set.seed(05021992)
N=20
packs = list("R03AK11"=list(c(750,75),c(500,200),c(400,200)),
             "R03AL03"=list(c(750,75),c(500,200),c(400,200)),
             "C01CA01"=list(c(200,100),c(750,30)))
lmdb=simPrescriptionData(N,packages=packs)
lpr=simAdmissionData(N)
drug1 = list(atc=c("R03AK11","R03AL03","R03AC02","R03AC04","R03AC19",
                    "R03AL02","R03AA01","R03AC18","R03AL01"),
             maxdepot=4000,
             period=as.Date(c("1995-01-01", "2012-12-31")),
             prescriptionwindow=2,
             doses=list(value=c(750,500,400,200,75),
                        min = c(250,200,200,100,25),
                        max = c(1000,600,800,600,100),
                        def = c(750,500,400,200,75)))
drug2=list(atc=c("C01CA01","C01AA05"),
           maxdepot=4000,
           period=as.Date(c("1995-01-01", "2012-12-31")),
           prescriptionwindow=2,
           doses=list(value=c(200, 400, 500,750),
                      min = c(100, 200, 250,750),
                      max = c(300, 800, 1000,750),
                      def = c(200, 400, 500,750)))
a <- medicinMacro(drugs=list("drug1"=drug1,"drug2"=drug2),drugdb=lmdb,admdb=lpr)

tagteam/heaven documentation built on Feb. 16, 2019, 8:21 p.m.