|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rm(list=ls()) |
|
|
|
|
|
|
|
|
|
|
|
library(plyr);library(dplyr, warn.conflicts = FALSE) |
|
|
library(tidyr);library(ggplot2) |
|
|
suppressMessages(library(multiwayvcov, warn.conflicts = F)) |
|
|
suppressMessages(library(lmtest, warn.conflicts = F)) |
|
|
suppressMessages(library(stargazer)) |
|
|
|
|
|
s = function(x){summary(factor(x))} |
|
|
|
|
|
|
|
|
A = readRDS('4-20-20_Network-KNearest_DeID_demed.RDS') |
|
|
|
|
|
H = read.csv('4-20-20_deid_nearestK.csv', |
|
|
na.strings=c('','NA'),strip.white=T,stringsAsFactors = F) |
|
|
Hprime = H[H$A.A7_Area.Neighborhood %in% names(which(table(H$A.A7_Area.Neighborhood) >= 30)),] |
|
|
Hprime = Hprime[which(!is.na(Hprime$A.A7_Area.Neighborhood)),] |
|
|
Hprime = Hprime[which(Hprime$A.A7_Area.Neighborhood != 'Bangalore NA'),] |
|
|
H = Hprime; rm(Hprime) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A$Job = mapvalues(A$D.D1_Occupation, |
|
|
from = c(12, |
|
|
13, |
|
|
19, |
|
|
2, |
|
|
20, |
|
|
21, |
|
|
3, |
|
|
4, |
|
|
6, |
|
|
7, |
|
|
9), |
|
|
to = c('Garbage', |
|
|
'Gardener', |
|
|
'Security', |
|
|
'Butcher', |
|
|
'Tailor', |
|
|
'Vendor', |
|
|
'Carpenter', |
|
|
'Construction', |
|
|
'Cook', |
|
|
'Corporate', |
|
|
'Electrician')) |
|
|
|
|
|
H$Job = mapvalues(H$D.D1_Occupation., |
|
|
from = c(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), |
|
|
to = c('Agriculture', |
|
|
'Butcher', |
|
|
'Carpenter', |
|
|
'Construction', |
|
|
'Labour', |
|
|
'Cook', |
|
|
'Corporation', |
|
|
'Driver', |
|
|
'Electrical', |
|
|
'Factory', |
|
|
'Flower', |
|
|
'Garbage', |
|
|
'Gardener', |
|
|
'Maid', |
|
|
'Mechanic', |
|
|
'Painter', |
|
|
'ProfessionalSvc', |
|
|
'Grocessory', |
|
|
'Security', |
|
|
'Tailor', |
|
|
'Vendor', |
|
|
'Government', |
|
|
'Housewife', |
|
|
'Student', |
|
|
'Other', |
|
|
NA, NA )) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sort (s(A$Job) / sum(!is.na(A$Job )) * 100 , decreasing = T) %>% round(2) |
|
|
|
|
|
sort (s(H$Job) / sum(!is.na(H$Job )) * 100 , decreasing = T) %>% round(2) |
|
|
|
|
|
|
|
|
|
|
|
|