Author: Juntao Lyu

Teaching slides weekly update

Looking for Understanding & Researching the City Tutorial (Friday afternoon seminars) slides? Download it from here (updated until 27/03/2020) understanding-and-researching-the-city-tutorial-3Download title: "Understanding and Researching the City Tutorial"author: "Juntao Lyu /J.Lyu@leeds.ac.uk"date: "r Sys.Date()"output:revealjs::revealjs_presentation:theme: nighthighlight: nullcenter: trueself_contained: falsereveal_plugins: ["notes", "search", "chalkboard"]reveal_options:chalkboard:theme: whiteboardtoggleNotesButton: tureslideNumber: truepreviewLinks: true  

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

Comparative Data Visualisation in R: an Example of Building a Data Frame from Scratch

When we do data analysis, we often deal with existed data-sets from an official database or survey. That is because R is a powerful tool allowing us to import a wide range of data formats, including excel, SPSS, Stata and other formats. In most occasions, we do not need to create a data frame ourselves. … Continue reading Comparative Data Visualisation in R: an Example of Building a Data Frame from Scratch

Dummy variables in R – an example for logistic regression modeling

Doing social research in a quantitative way means we have to fix our data with our expected theories. This is a very different approach from qualitative research, as the grounded theory is not very likely to be purely constructed by numbers. Thus, we sometimes need to fix our data in order to meet our theoretical … Continue reading Dummy variables in R – an example for logistic regression modeling