Tag: health insurance

Data analysis of the ASPC Paper “Social Health Insurance Inequalities in China” – RStudio Scripts

#RStudio setting: # Import the data library(readxl)## readxl_example()## ??readxlhealthcare<-read_excel("Healthcare2014.xlsx", "Sheet1")head(healthcare)str(healthcare)sum(is.na(healthcare))save(healthcare,file = "healthcare.Rda") # Select variables library(dplyr)load("healthcare.Rda")healthcare01<- dplyr::select (healthcare, provcode, Ab01,Ac01, Ad01,Ae01,Ag01,Ah001,Ai01,Aj01,Ah101,Ah201,Ah301,Ah401,Ah501,Ah601,Ah701,Ah801, B01_1,B02_1,B07_1,B07_1,B07_2,B07_3,B07_4,B07_5,B07_6,B07_7,B07_8,B07_9, D01,D06,F01,F02,F021,F022,F023,F024,F025,F031,F041,F042,F043,F04C,F03,F06)useBytes = TRUEstr(healthcare01)save(healthcare01,file = "healthcare01.Rda")load("healthcare01.Rda")library(dplyr)h01<-filter(healthcare01,Ab01>0&Ac01>0&Ae01>0&Ag01>0&Ai01>0&Ah001>=0&Ah101>=0&Ah201>=0&Ah301>=0&Ah401>=0&Ah501>=0&Ah601>=0&Ah701>=0&Ah801>=0&F01>0&D01>=0&F01>0&F03>0)h01<-filter(h01,B01_1>0|B01_1< -7)h01<-filter(h01,F041< -7 |F041>= 0)h01<-filter(h01,F042< -7 |F042>= 0)sum(is.na(h01))str(h01) # Rename variables ## provinceh01$provcode[h01$provcode== 13]<- "Hebei"h01$provcode[h01$provcode== 23]<- "Heilongjiang"h01$provcode[h01$provcode== 31]<- "Shanghai"h01$provcode[h01$provcode== 33]<- "Zhejiang"h01$provcode[h01$provcode== 34]<- "Anhui"h01$provcode[h01$provcode== 44]<- "Guangdong"h01$provcode[h01$provcode== 51]<- "Sichuan"h01$provcode[h01$provcode== 61]<- "Shannxi"h01$province<-h01$provcode## … Continue reading Data analysis of the ASPC Paper “Social Health Insurance Inequalities in China” – RStudio Scripts