-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
64 lines (64 loc) · 2.4 KB
/
.Rhistory
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
library(bigreadr)
library(data.table)
library(R.utils)
library(bit64)
library(dplyr)
dt = readRDS(file="diag.RDS")
setwd("G:/Optum/EHR/ehr10p")
dt = readRDS(file="diag.RDS")
dxmd = filter(dt, DIAGNOSIS_CD %in% c('K703','K744','K745','K746',
'R18','I850','I859','I864','I982','I983',
'5712','5715','5722','5723','5724',
'78959','4560','4561','4562','45621','56723')) %>%
mutate(dxdate = as.Date(DIAG_DATE, '%m-%d-%Y')) %>% group_by(PTID) %>%
arrange(dxdate) %>% slice(1)
dmxd
rm(dxmd)
dxcir = filter(dt, DIAGNOSIS_CD %in% c('K703','K744','K745','K746',
'R18','I850','I859','I864','I982','I983',
'5712','5715','5722','5723','5724',
'78959','4560','4561','4562','45621','56723')) %>%
mutate(dxdate = as.Date(DIAG_DATE, '%m-%d-%Y')) %>% group_by(PTID) %>%
arrange(dxdate) %>% slice(1)
dtrx = big_fread2(file="hum_201911_rx_presc_sample_10.txt", part_size = 1000*1024^2,
select = c(1,2,4,5) )
head(dtrx)
?grepl
dtt = dtrx %>% filter(grepl("pregabalin",DRUG_NAME,ignore.case=TRUE))
head(dtt)
dtt = dtrx %>% filter(grepl("pregabalin",DRUG_NAME,ignore.case=TRUE) |
grepl("gabapentin",DRUG_NAME,ignore.case=TRUE))
unique(dtt$DRUG_NAME)
length(unique(dtt$PTID))
length(unique(dtt$PTID))/nrow(dtcir)
length(unique(dtt$PTID))/nrow(dxcir)
dxcir_rx = dxcir %>% left_join(dtt %>% group_by(PATID) %>% slice(1),by="PTID")
dxcir_rx = dxcir %>% left_join(dtt %>% group_by(PTID) %>% slice(1),by="PTID")
dxcir_rx = dxcir %>% left_join(dtt %>% group_by(PTID) %>% slice(1),by="PTID") %>%
mutate(rx = ifelse(is.na(RXDATE),0,1))
prop.table(table(dxcir_rx$rx))
table(dxcir_rx$rx)
library(bigreadr)
library(data.table)
library(R.utils)
library(bit64)
library(dplyr)
setwd("G:/Optum/EHR/ehr10p")
dt = readRDS(file="diag.RDS")
dxcir = filter(dt, DIAGNOSIS_CD %in% c('K7030', 'K7031', 'K717', 'K74', 'K743', 'K744',
'K745', 'K746', 'K7460', 'K7469', 'R188',
'5712','5715','5716','78959','5733')) %>%
mutate(dxdate = as.Date(DIAG_DATE, '%m-%d-%Y')) %>% group_by(PTID) %>%
arrange(dxdate) %>% slice(1)
saveRDS(dxcir, file="dx_cirrhosis.RDS")
dtrx = big_fread2(file="hum_201911_rx_presc_sample_10.txt", part_size = 1000*1024^2,
select = c(1,2,4,5) )
dtt = dtrx %>% filter(grepl("pregabalin",DRUG_NAME,ignore.case=TRUE) |
grepl("gabapentin",DRUG_NAME,ignore.case=TRUE))
dxcir_rx = dxcir %>% left_join(dtt %>% group_by(PTID) %>% slice(1),by="PTID") %>%
mutate(rx = ifelse(is.na(RXDATE),0,1))
prop.table(table(dxcir_rx$rx))
library(tictoc)
library(remiod)
install.packages('rjags')
library(remiod)