把这列表格的内容分开,按照下面这种格式进行分组统计,后续再进行分析。
getwd()
q<-read.csv("chuli.csv",stringsAsFactors = F)
qq<-as.matrix(q)
w<-as.vector(qq)
tang<-rep(0,400)
chidai<-rep(0,400)
nao<-rep(0,400)
xueya<-rep(0,400)
guan<-rep(0,400)
xuezhi<-rep(0,400)
pinxue<-rep(0,400)
qita<-rep(0,400)
team1=grep("糖尿病",w)
team2=grep("痴呆",w)
team3=grep("脑血管病",w)
team4=grep("高血压病",w)
team5=grep("冠心病",w)
team6=grep("高血脂症",w)
team7=grep("贫血",w)
team8=grep("其他",w)
tang[team1]=1
chidai[team2]=1
nao[team3]=1
xueya[team4]=1
guan[team5]=1
xuezhi[team6]=1
pinxue[team7]=1
qita[team8]=1
disease<-data.frame(tang,