# example 1.2
library(asaur)
gastricXelox[23: 27, ]
##    timeWeeks delta
## 23        42     1
## 24        43     1
## 25        43     0
## 26        46     1
## 27        48     0
# example 1.3
head(pancreatic)
##   stage    onstudy progression      death
## 1     M 12/16/2005    2/2/2006 10/19/2006
## 2     M   1/6/2006   2/26/2006  4/19/2006
## 3    LA   2/3/2006    8/2/2006  1/19/2007
## 4     M  3/30/2006           .  5/11/2006
## 5    LA  4/27/2006   3/11/2007  5/29/2007
## 6     M   5/7/2006   6/25/2006 10/11/2006
# example 1.4
prostateSurvival[88:95, ]
##    grade stage ageGroup survTime status
## 88  poor    T2    75-79       33      0
## 89  mode    T2    75-79        6      0
## 90  mode   T1c    75-79       15      2
## 91  mode    T2    70-74        6      2
## 92  mode  T1ab      80+       93      1
## 93  poor    T2      80+       60      2
## 94  mode    T2      80+        1      0
## 95  mode  T1ab    75-79       34      0
# example 1.5
pharmacoSmoking[1:6, 2:8]
##   ttr relapse         grp age gender     race employment
## 1 182       0   patchOnly  36   Male    white         ft
## 2  14       1   patchOnly  41   Male    white      other
## 3   5       1 combination  25 Female    white      other
## 4  16       1 combination  54   Male    white         ft
## 5   0       1 combination  45   Male    white      other
## 6 182       0 combination  43   Male hispanic         ft
# example 1.6
hepatoCellular[c(1,2,3,65,71), c(2,3,16:20,24,47)]
##    Age Gender OS Death RFS Recurrence   CXCL17T CD4N     Ki67
## 1   57      0 83     0  13          1 113.94724    0  6.04350
## 2   58      1 81     0  81          0  54.07154   NA       NA
## 3   65      1 79     0  79          0  22.18883   NA       NA
## 65  38      1  5     1   5          1 106.78169    0 44.24411
## 71  57      1 11     1  11          1  98.49680    0 99.59232
# exerise 1.2 How many patients had the event?
a <-sum(gastricXelox$delta == 1)
a
## [1] 32
# exercise 1.2 The number of person-weeks of follow up time?
b <- sum(gastricXelox$timeWeeks[gastricXelox$delta == 1])
b
## [1] 999
# exercise 1.2 The event rate per person-week?
c <- b/a
c
## [1] 31.21875