2010-2015年甘肃AEFI监测数据汇总

library(dplyr)
library(stringr)
aefi <- read.csv("C:\\Users\\liangxf\\Desktop\\页1.csv",header = T,stringsAsFactors = F)
for(i in 1:length(aefi$主键))
{
  if (nchar(aefi$反应分类[i])==0)
  {
    aefi$反应分类[i]=aefi$初步分类[i]
  }
}
for(i in 1:length(aefi$主键))
{
  if (nchar(aefi$最终临床诊断[i])==0)
  {
    aefi$最终临床诊断[i]=aefi$初步临床诊断[i]
  }
}
data <- mutate(aefi,year=substr(aefi$报告卡编号,8,11))%>%
  filter(year>=2010 & 疫苗1.疫苗名称 %in%c("Hib","百白破(无细胞)","脊灰(灭活)","甲肝(灭活)","狂犬病(Vero)","狂犬病(Vero冻干)","流感(裂解)","流脑A+C(结合)","流脑A群","轮状病毒","麻风","腮腺炎","水痘","乙肝(CHO)","乙肝(酵母)","乙脑(减毒)"))%>%
  select(year,疫苗1.疫苗名称,反应分类,最终临床诊断)

aefinew <- read.csv("C:\\Users\\liangxf\\Desktop\\AEFI个案信息.csv",skip = 1,header = T,stringsAsFactors = F)
for(i in 1:length(aefinew$编码))
{
  if (nchar(aefinew$最终临床诊断[i])==0)
  {
    aefinew$最终临床诊断[i]=aefinew$初步临床诊断[i]
  }
}

datanew <- mutate(aefinew,year=substr(aefinew$编码,10,13))%>%
  filter(疫苗1.疫苗名称 %in%c("Hib疫苗","百白破(无细胞)","脊灰疫苗(灭活Salk株)","甲肝(灭活)","狂犬病疫苗(Vero)","狂犬病疫苗(Vero冻干)","流感疫苗(裂解)","流脑A+C疫苗(结合)","A群流脑疫苗","轮状病毒疫苗","麻风疫苗","腮腺炎疫苗","水痘疫苗","乙肝疫苗(CHO)","乙肝疫苗(汉逊酵母)","乙肝疫苗(酿酒酵母)","乙脑疫苗(减毒)"))%>%
  select(year,疫苗1.疫苗名称,反应分类,最终临床诊断)


resul <- rbind(data,datanew)

res <- xtabs(~year+反应分类,data=resul)
write.csv(res,"C:\\Users\\liangxf\\Desktop\\resul.csv")


res <- xtabs(~最终临床诊断+year,data=resul)
write.csv(res,"C:\\Users\\liangxf\\Desktop\\resul.csv")


da <- filter(resul,反应分类=="一般反应")
res <- xtabs(~疫苗1.疫苗名称+最终临床诊断,data=da)
write.csv(res,"C:\\Users\\liangxf\\Desktop\\resul.csv")

da <- filter(resul,反应分类=="异常反应")
res <- xtabs(~疫苗1.疫苗名称+最终临床诊断,data=da)
write.csv(res,"C:\\Users\\liangxf\\Desktop\\resul2.csv")


result <- filter(aefi,反应分类=="一般反应" & 发热=="≥38.6")%>%
  select(反应分类,发热,疫苗1.疫苗名称,疫苗1.生产企业)%>%
  filter(疫苗1.疫苗名称 %in%c("Hib","百白破(无细胞)","脊灰(灭活)","甲肝(灭活)","狂犬病(Vero)","狂犬病(Vero冻干)","流感(裂解)","流脑A+C(结合)","流脑A群","轮状病毒","麻风","腮腺炎","水痘","乙肝(CHO)","乙肝(酵母)","乙脑(减毒)"))
resultnew <- filter(aefinew,反应分类=="一般反应" & 发热.腋温..范围=="≥38.6℃")%>%
  select(反应分类,发热=发热.腋温..范围,疫苗1.疫苗名称,疫苗1.生产企业)%>%
  filter(疫苗1.疫苗名称 %in%c("Hib疫苗","百白破(无细胞)","脊灰疫苗(灭活Salk株)","甲肝(灭活)","狂犬病疫苗(Vero)","狂犬病疫苗(Vero冻干)","流感疫苗(裂解)","流脑A+C疫苗(结合)","A群流脑疫苗","轮状病毒疫苗","麻风疫苗","腮腺炎疫苗","水痘疫苗","乙肝疫苗(CHO)","乙肝疫苗(汉逊酵母)","乙肝疫苗(酿酒酵母)","乙脑疫苗(减毒)"))

fare <- rbind(result,resultnew)
res <- as.data.frame(ftable(xtabs(~疫苗1.疫苗名称+疫苗1.生产企业+反应分类,data=fare)))
fare <- filter(res,Freq>0)
write.csv(fare,"C:\\Users\\liangxf\\Desktop\\fare.csv")


result <- filter(aefi,反应分类=="异常反应" & 最终临床诊断=="过敏性皮疹")%>%
  select(反应分类,最终临床诊断,疫苗1.疫苗名称,疫苗1.生产企业)%>%
  filter(疫苗1.疫苗名称 %in%c("Hib","百白破(无细胞)","脊灰(灭活)","甲肝(灭活)","狂犬病(Vero)","狂犬病(Vero冻干)","流感(裂解)","流脑A+C(结合)","流脑A群","轮状病毒","麻风","腮腺炎","水痘","乙肝(CHO)","乙肝(酵母)","乙脑(减毒)"))
resultnew <- filter(aefinew,反应分类=="异常反应" & 最终临床诊断=="过敏性皮疹")%>%
  select(反应分类,最终临床诊断,疫苗1.疫苗名称,疫苗1.生产企业)%>%
  filter(疫苗1.疫苗名称 %in%c("Hib疫苗","百白破(无细胞)","脊灰疫苗(灭活Salk株)","甲肝(灭活)","狂犬病疫苗(Vero)","狂犬病疫苗(Vero冻干)","流感疫苗(裂解)","流脑A+C疫苗(结合)","A群流脑疫苗","轮状病毒疫苗","麻风疫苗","腮腺炎疫苗","水痘疫苗","乙肝疫苗(CHO)","乙肝疫苗(汉逊酵母)","乙肝疫苗(酿酒酵母)","乙脑疫苗(减毒)"))

pizhen <- rbind(result,resultnew)
res <- as.data.frame(ftable(xtabs(~疫苗1.疫苗名称+疫苗1.生产企业+反应分类,data=pizhen)))
pizhen <- filter(res,Freq>0)
write.csv(pizhen,"C:\\Users\\liangxf\\Desktop\\pizhen.csv")


for (i in 1:length(yichangnew$drugs)) {
  if(length(unlist(strsplit(yichangnew$events[i], "-")))==2){
    yichangnew$events[i] <- as.character(unlist(strsplit(yichangnew$events[i], "-"))[2])
  }
}

评论

此博客中的热门博文

V2ray websocket(ws)+tls+nginx分流

Rstudio 使用代理