-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.info.death.R
131 lines (107 loc) · 3.88 KB
/
check.info.death.R
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
library(tidyverse)
library(openxlsx)
library(readxl)
library(dplyr)
library(lubridate)
####1.check,info.ARTInitialDate####
fcg.check <- read_excel("FCG.xlsx", sheet = "check")
str(fcg.check)
fcg.check$VL <- as.numeric(fcg.check$VL)
fcg.check$ID <- gsub("'",'',fcg.check$ID)
fcg.check$Key <- gsub("'",'',fcg.check$Key)
summary(fcg.check$VL)
fcg.info <- read_excel("FCG.xlsx", sheet = "info")
str(fcg.info)
fcg.info$ARTinitialDate <- as.Date(fcg.info$ARTinitialDate)
fcg.info <- fcg.info %>% distinct(ID, .keep_all = TRUE)
fcg <- fcg.check %>% left_join(fcg.info, by = "ID")
str(fcg)
summary(fcg$VL)
qz.check <- read_excel("QZ.xlsx", sheet = "check")
qz.check$VL <- as.numeric(qz.check$VL)
qz.check$ID <- gsub("'",'',qz.check$ID)
qz.check$Key <- gsub("'",'',qz.check$Key)
qz.info <- read_excel("QZ.xlsx", sheet = "info")
str(qz.info)
qz.info$ARTinitialDate <- as.Date(qz.info$ARTinitialDate)
qz.info <- qz.info %>% distinct(ID, .keep_all = TRUE)
qz.info$ID <- gsub("'",'',qz.info$ID)
qz.info$Key <- gsub("'",'',qz.info$Key)
qz <- qz.check %>% left_join(qz.info, by = "ID")
str(qz)
summary(qz$VL)
cz.check <- read_excel("CZ.xlsx", sheet = "check")
cz.check$VL <- as.numeric(cz.check$VL)
cz.check$ID <- gsub("'",'',cz.check$ID)
cz.check$Key <- gsub("'",'',cz.check$Key)
cz.info <- read_excel("CZ.xlsx", sheet = "info")
str(cz.info)
cz.info$ARTinitialDate <- as.Date(cz.info$ARTinitialDate)
cz.info <- cz.info %>% distinct(ID, .keep_all = TRUE)
cz <- cz.check %>% left_join(cz.info, by = "ID")
str(cz)
cz$TestingDate <- as.Date(cz$TestingDate)
cz$VLDate <- as.Date(cz$VLDate)
cz$Gly <- as.numeric(cz$Gly)
summary(cz$VL)
nn.check <- read_excel("NN.xlsx", sheet = "check")
nn.check$VL <- as.numeric(nn.check$VL)
nn.check$Gly <- as.numeric(nn.check$Gly)
nn.check$TestingDate <- as.Date(nn.check$TestingDate)
nn.check$VLDate <- as.Date(nn.check$VLDate)
str(nn.check)
nn.info <- read_excel("NN.xlsx", sheet = "info")
str(nn.info)
nn.info$ARTinitialDate <- as.Date(nn.info$ARTinitialDate)
nn.info <- nn.info %>% distinct(ID, .keep_all = TRUE)
nn <- nn.check %>% left_join(nn.info, by = "ID")
str(nn)
nn$VLDate <- as.character(nn$VLDate)
summary(nn$VL)
write.xlsx(fcg, "fcg.R.xlsx")
write.xlsx(qz, "qz.R.xlsx")
write.xlsx(cz, "cz.R.xlsx")
write.xlsx(nn, "nn.R.xlsx")
str(fcg)
str(qz)
str(cz)
str(nn)
all <- bind_rows(fcg, qz, cz, nn)
str(all)
write.xlsx(all, "all.xlsx")
fcg <- read_excel("fcg.R.xlsx")
qz <- read_excel("qz.R.xlsx")
cz <- read_excel("cz.R.xlsx")
nn <- read_excel("nn.R.xlsx")
####2.death####
fcg.death <-read_excel("FCG.xlsx", sheet = "death")
fcg.death$DiedDate <- as.Date(fcg.death$DiedDate)
str(fcg.death)
cz.death <- read_excel("CZ.xlsx", sheet = "death")
cz.death$DiedDate <- as.Date(cz.death$DiedDate)
str(cz.death)
qz.death <- read_excel("QZ.xlsx", sheet = "death")
qz.death$DiedDate <- as.Date(qz.death$DiedDate)
str(qz.death)
nn.death <- read_excel("NN.xlsx", sheet = "death")
nn.death$DiedDate <- as.Date(nn.death$DiedDate)
str(nn.death)
death <- bind_rows(fcg.death, cz.death, qz.death, nn.death)
death <- death %>% distinct(ID, .keep_all = TRUE)
write.xlsx(death, "death.xlsx")
####3.info.Regimen####
fcg.info <- read_excel("FCG.xlsx", sheet = "info.1")
nn.info <- read_excel("NN.xlsx", sheet = "info.1")
cz.info <- read_excel("CZ.xlsx", sheet = "info.1")
qz.info <- read_excel("QZ.xlsx", sheet = "info.1",
col_types = c("text", "text", "text", "date", "text", "text", "text", "text", "text", "text"))
qz.info$BirthDate <- as.character(qz.info$BirthDate)
str(qz.info)
write.xlsx(fcg.info, "fcg.info.xlsx")
write.xlsx(nn.info, "nn.info.xlsx")
write.xlsx(cz.info, "cz.info.xlsx")
write.xlsx(qz.info, "qz.info.xlsx")
info <- bind_rows(fcg.info, nn.info, qz.info, cz.info)
info$ID <- gsub("'",'',info$ID)
info <- info %>% distinct(ID, .keep_all = TRUE)
write.xlsx(info, "info.xlsx")