dpp: Create data preprocessing object (dpp)

Description Usage Arguments Details Author(s) Examples

Description

Create data preprocessing object

Usage

1
dpp(id = "pnr")

Arguments

id

Character. Name of subject id variable. Default is "pnr"

Details

Create data preprocessing object (dpp)

Author(s)

Helene Charlotte Rytgaard, Anders Munch & Thomas Alexander Gerds

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
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
## Not run: 
library(heaven)
library(data.table)

dc <- contentSAS("x:/Data/Rawdata_Hurtig/706818/diag_indl.sas7bdat")
d2 <- contentSAS("x:/Data/Rawdata_Hurtig/706818/lmdb.sas7bdat")
# dll <- contentSAS("x:/Data/Rawdata_Hurtig/706818/labka.sas7bdat",obs=10)
pp <- contentSAS("x:/Data/Rawdata_Hurtig/706818/pop.sas7bdat")
pp10 <- importSAS("x:/Data/Rawdata_Hurtig/706818/pop.sas7bdat",obs=10,date.vars="FdaTo")

ddd <- importSAS("x:/Data/Rawdata_Hurtig/706818/doede.sas7bdat",
       keep=c("pnr","doddato"),obs=10,date.vars="doddato")

## d <- importSAS("x:/Data/Rawdata_Hurtig/706818/diag_indl.sas7bdat",
obs=100,where="pnr ne ''",keep=c("pnr","uddto"))

source("v:/Data/Workdata/706818/ThomasAlexanderGerds/testheaven/R/new-process.R")
setwd("v:/Data/Workdata/706818/ThomasAlexanderGerds/testheaven/")
x <- dpp()
addData(x,
        name="lmdb",
        variables=c("atc","date"="eksd")) <- "x:/Data/Rawdata_Hurtig/706818/lmdb.sas7bdat"
addData(x,
        name="pop",
        variables=c("sex","date"="fdato")) <- "x:/Data/Rawdata_Hurtig/706818/pop.sas7bdat"
addData(x,
        name="dod",
        variables=c("date"="doddato")) <- "x:/Data/Rawdata_Hurtig/706818/doede.sas7bdat"
addData(x,
        name="lpr",
        variables=c("diag",
                    "diagtype",
                    "date"="inddto",
                    "date"="uddto",
                    "pattype")) <- "x:/Data/Rawdata_Hurtig/706818/diag_indl.sas7bdat"
addInclusion(x,"firstAF") <- importer("lpr",
                                      keep=c("pnr","diag","inddto","uddto","pattype"),
                                      where="inddto >= '01jan97'd and (diag contains 'DI48' or
 substr(diag,1,5) in ('42793' '42794')) and pnr ne ' ' and pattype ne 3",
                                      select="unique")
addExclusion(x,"earlyAF") <- importer("lpr",
                                      keep=c("pnr","diag","inddto","uddto","pattype"),
                                      where="inddto < '01jan97'd and (diag contains
 'DI48' or substr(diag,1,5) in ('42793' '42794')) and pnr ne ' ' and pattype ne 3",
                                      select="unique")
## start followup
addVariable(x,target="afbsl") <- selector(data="studypop",
                                          var="afstart7",
                                          name="afstart7",
                                          sortkey=NULL,
                                          search.term=NULL,
                                          select="expression",
                                          collect=expression(uddto+7))
## end followup
addVariable(x,target="studypop") <- selector(data="dod",
                                             var="efup.date",
                                             name="efup.date",
                                             sortkey=NULL,
                                             search.term=NULL,
                                             select="expression",
                                             collect=expression(pmin(doddato,
                                                                     as.Date("2017-01-01"),
                                                                     na.rm=TRUE)))
addVariable(x,target="afbsl") <- selector(data="pop",
                                          var="sex",
                                          name="sex",
                                          sortkey=NULL,
                                          search.term=NULL,
                                          select="expression",
                                          collect=expression(factor(sex,
                                                                    levels=c(0,1),
                                                                    labels=c("Female","Male"))))
addVariable(x,target="afbsl") <- selector(data="pop",
                                          var="fdato",
                                          name="birthday",
                                          sortkey=NULL,
                                          search.term=NULL,
                                          select="variable",
                                          collect="fdato")
addVariable(x,
            target="afbsl") <- selector(data="afbsl",
                                        var="age_af7",
                                        sortkey=NULL,
                                        search.term=NULL,
                                        select="expression",
                                        collect=expression(round(as.numeric(afstart7
                                                                            -birthday)/365.25,1)))
addVariable(x,target="fup",type="rbind") <- selector(data="lmdb",
                                                     var="atc",
                                                     name="drug",
                                                     sortkey="eksd",
                                                     search.term="B01A")
addVariable(x,target="fup",type="rbind") <- selector(data="lpr",
                                                     var="diag",
                                                     name="stroke",
                                                     sortkey="inddto",
                                                     search.term="I63")


source("v:/Data/Workdata/706818/ThomasAlexanderGerds/testheaven/R/new-process.R")
x <- process(x,n=1000,fish=10000,show.sas.code=0L,restart="all")

x0$data$afbsl
x0$data$fup


## x <- process(x,n=Inf,fish=Inf,show.sas.code=0L)


x1 <- process(x,n=1000,fish=Inf,show.sas.code=0L)
source("v:/Data/Workdata/706818/ThomasAlexanderGerds/testheaven/R/new-process.R")


## if substr(atc,1,7) in ('B01AA03','B01AA04') then output vka;
## if substr(atc,1,7) in ('B01AE07','B01AF01','B01AF02','B01AF03') then output noac;
## if substr(atc,1,7) in ('B01AE07') then output dabi;
## if substr(atc,1,7) in ('B01AF01') then output riva;
## if substr(atc,1,7) in ('B01AF02') then output apix;
## if substr(atc,1,7) in ('B01AF03') then output edox;

source("v:/Data/Workdata/706818/ThomasAlexanderGerds/testheaven/R/new-process.R")
x1 <- process(x,n=1000,fish=Inf,show.sas.code=0L)

x1 <- process(x1,n=1000,fish=Inf,show.sas.code=0L)


system.time(x <- process(x,n=Inf,fish=Inf,show.sas.code=0L))
## x <- process(x,n=30,fish=100000,show.sas.code=0L,restart="age")
## system.time(x <- process(x,n=1000,fish=Inf,show.sas.code=0L))
system.time(x <- process(x,n=Inf,fish=Inf,show.sas.code=0L))
print(object.size(x),units="Mb")

## End(Not run)

tagteam/heaven documentation built on June 21, 2019, 6:37 p.m.