-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main_Workers.R
executable file
·183 lines (146 loc) · 11.6 KB
/
Main_Workers.R
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#DM_Navdeep_Project
#load required Libraries
library(sp)
library(ggplot2)
library(maptools)
library(RColorBrewer)
library(rJava)
library(knitr)
suppressPackageStartupMessages(library(googleVis))
#Read dataset
ind_df <- read.csv("dis_work.csv")
#Remove Irrelevant rows
mydata <- ind_df[7:4866,]
#Give Names to colums
mydata <- setNames( mydata,c("Table_n","State_c","Dist_c","States","u_r","Dis",
"Age_gp","Total_p","Total_m","Total_f","Main_p",
"Main_m","Main_f","Marg3_p","Marg3_m","Marg3_f",
"Marg3_6_p","Marg3_6_m","Marg3_6_f","NonW_p","NonW_m","NonW_f"))
#Drop irrelevant irrelevant and redundant Colums
mydata <- mydata [-c(1,3)]
#head(mydata, n=10)
mydata_InSeeing_Main <- mydata[mydata$Age_gp=='15-59' & mydata$Dis=='In-Seeing' & mydata$u_r!= 'Rural'
& mydata$u_r!='Urban' & mydata$States!= 'INDIA',]
mydata_InSeeing_Main <- mydata_InSeeing_Main[order(mydata_InSeeing_Main$States),]
#Convert charecter data to numeric
mydata_InSeeing_Main$Main_p <- as.numeric(as.character(mydata_InSeeing_Main$Main_p))
mydata_InSeeing_Main$Main_m <- as.numeric(as.character(mydata_InSeeing_Main$Main_m))
mydata_InSeeing_Main$Main_f <- as.numeric(as.character(mydata_InSeeing_Main$Main_f))
#calculate number per 100 of Main population
mydata_InSeeing_Main$Main_male <- (sprintf("%.f", mydata_InSeeing_Main$Main_m * 100/mydata_InSeeing_Main$Main_p))
mydata_InSeeing_Main$Main_female <- sprintf("%.f", mydata_InSeeing_Main$Main_f * 100/mydata_InSeeing_Main$Main_p)
#Draw the Map of india indicating In_seeing Main disabled Male Workers per 100 Disabled Parsons in each state
map_1 <- gvisGeoChart(data = mydata_InSeeing_Main, locationvar = "States", colorvar = "Main_male",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InSeeing_Male")
#Draw the Map of india indicating In-Seeing Main Disabled Female Workers per 100 Disabled Parsons in each state
map_2 <- gvisGeoChart(data = mydata_InSeeing_Main, locationvar = "States", colorvar = "Main_female",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InSeeing_Female")
plot(gvisMerge(map_1,map_2, horizontal = 'TRUE', chartid ="In-Seeing" ))
mydata_InSeeing_Main$Main_male <- as.numeric(as.character(mydata_InSeeing_Main$Main_male))
mydata_InSeeing_Main$Main_female <- as.numeric(as.character(mydata_InSeeing_Main$Main_female))
col1 <- gvisColumnChart(mydata_InSeeing_Main, xvar = "States", yvar = c("Main_male", "Main_female"))
plot(col1)
#pie <- gvisPieChart(mydata_InSeeing_Main, labelvar = "States", numvar = "Main_male")
#plot(pie)
# Drawing map for In-Hearing Disability
mydata_InHearing_Main <- mydata[mydata$Age_gp=='15-59' & mydata$Dis=='In-Hearing' & mydata$u_r!= 'Rural'
& mydata$u_r!='Urban' & mydata$States!= 'INDIA',]
mydata_InHearing_Main <- mydata_InHearing_Main[order(mydata_InHearing_Main$States),]
#Convert charecter data to numeric
mydata_InHearing_Main$Main_p <- as.numeric(as.character(mydata_InHearing_Main$Main_p))
mydata_InHearing_Main$Main_m <- as.numeric(as.character(mydata_InHearing_Main$Main_m))
mydata_InHearing_Main$Main_f <- as.numeric(as.character(mydata_InHearing_Main$Main_f))
#calculate number per 100 of Main population
mydata_InHearing_Main$Main_male <- (sprintf("%.f", mydata_InHearing_Main$Main_m * 100/mydata_InHearing_Main$Main_p))
mydata_InHearing_Main$Main_female <- sprintf("%.f", mydata_InHearing_Main$Main_f * 100/mydata_InHearing_Main$Main_p)
#Draw the Map of india indicating In_Hearing Main disabled Male Workers per 100 Disabled Parsons in each state
map_3 <- gvisGeoChart(data = mydata_InHearing_Main, locationvar = "States", colorvar = "Main_male",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InHearing_Male")
#Draw the Map of india indicating In-Hearing Main Disabled Female Workers per 100 Disabled Parsons in each state
map_4 <- gvisGeoChart(data = mydata_InHearing_Main, locationvar = "States", colorvar = "Main_female",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InHearing_Female")
plot(gvisMerge(map_3,map_4, horizontal = 'TRUE', chartid ="In-Hearing" ))
#Drawing Column Chart
mydata_InHearing_Main$Main_male <- as.numeric(as.character(mydata_InHearing_Main$Main_male))
mydata_InHearing_Main$Main_female <- as.numeric(as.character(mydata_InHearing_Main$Main_female))
col2 <- gvisColumnChart(mydata_InHearing_Main, xvar = "States", yvar = c("Main_male", "Main_female"))
plot(col2)
# Drawing map for In-Speach Disability
mydata_InSpeech_Main <- mydata[mydata$Age_gp=='15-59' & mydata$Dis=='In-Speech' & mydata$u_r!= 'Rural'
& mydata$u_r!='Urban' & mydata$States!= 'INDIA',]
mydata_InSpeech_Main <- mydata_InSpeech_Main[order(mydata_InSpeech_Main$States),]
#Convert charecter data to numeric
mydata_InSpeech_Main$Main_p <- as.numeric(as.character(mydata_InSpeech_Main$Main_p))
mydata_InSpeech_Main$Main_m <- as.numeric(as.character(mydata_InSpeech_Main$Main_m))
mydata_InSpeech_Main$Main_f <- as.numeric(as.character(mydata_InSpeech_Main$Main_f))
#calculate number per 100 of Main population
mydata_InSpeech_Main$Main_male <- (sprintf("%.f", mydata_InSpeech_Main$Main_m * 100/mydata_InSpeech_Main$Main_p))
mydata_InSpeech_Main$Main_female <- sprintf("%.f", mydata_InSpeech_Main$Main_f * 100/mydata_InSpeech_Main$Main_p)
#Draw the Map of india indicating In_Speach Main disabled Male Workers per 100 Disabled Parsons in each state
map_5 <- gvisGeoChart(data = mydata_InSpeech_Main, locationvar = "States", colorvar = "Main_male",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InSpeech_Male")
#Draw the Map of india indicating In-Speach Main Disabled Female Workers per 100 Disabled Parsons in each state
map_6 <- gvisGeoChart(data = mydata_InSpeech_Main, locationvar = "States", colorvar = "Main_female",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InSpeech_Female")
plot(gvisMerge(map_5,map_6, horizontal = 'TRUE', chartid ="In-Speech" ))
#Drawing Column Chart
mydata_InSpeech_Main$Main_male <- as.numeric(as.character(mydata_InSpeech_Main$Main_male))
mydata_InSpeech_Main$Main_female <- as.numeric(as.character(mydata_InSpeech_Main$Main_female))
col3 <- gvisColumnChart(mydata_InSpeech_Main, xvar = "States", yvar = c("Main_male", "Main_female"))
plot(col3)
# Drawing map for In-Movement Disability
mydata_InMovemenMain_Main <- mydata[mydata$Age_gp=='15-59' & mydata$Dis=='In-Movement' & mydata$u_r!= 'Rural'
& mydata$u_r!='Urban' & mydata$States!= 'INDIA',]
mydata_InMovemenMain_Main <- mydata_InMovemenMain_Main[order(mydata_InMovemenMain_Main$States),]
#Convert charecter data to numeric
mydata_InMovemenMain_Main$Main_p <- as.numeric(as.character(mydata_InMovemenMain_Main$Main_p))
mydata_InMovemenMain_Main$Main_m <- as.numeric(as.character(mydata_InMovemenMain_Main$Main_m))
mydata_InMovemenMain_Main$Main_f <- as.numeric(as.character(mydata_InMovemenMain_Main$Main_f))
#calculate number per 100 of Main population
mydata_InMovemenMain_Main$Main_male <- (sprintf("%.f", mydata_InMovemenMain_Main$Main_m * 100/mydata_InMovemenMain_Main$Main_p))
mydata_InMovemenMain_Main$Main_female <- sprintf("%.f", mydata_InMovemenMain_Main$Main_f * 100/mydata_InMovemenMain_Main$Main_p)
#Draw the Map of india indicating In_Movement Main disabled Male Workers per 100 Disabled Parsons in each state
map_7 <- gvisGeoChart(data = mydata_InMovemenMain_Main, locationvar = "States", colorvar = "Main_male",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InMovemenMain_Male")
#Draw the Map of india indicating In-Movement Main Disabled Female Workers per 100 Disabled Parsons in each state
map_8 <- gvisGeoChart(data = mydata_InMovemenMain_Main, locationvar = "States", colorvar = "Main_female",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "InMovemenMain_Female")
plot(gvisMerge(map_7,map_8, horizontal = 'TRUE', chartid ="In-Movement" ))
#Drawing Column Chart
mydata_InMovemenMain_Main$Main_male <- as.numeric(as.character(mydata_InMovemenMain_Main$Main_male))
mydata_InMovemenMain_Main$Main_female <- as.numeric(as.character(mydata_InMovemenMain_Main$Main_female))
col4 <- gvisColumnChart(mydata_InMovemenMain_Main, xvar = "States", yvar = c("Main_male", "Main_female"))
plot(col4)
# Drawing map for Mental-Retardation Disability
MyData_MentalRetardation_Main <- mydata[mydata$Age_gp=='15-59' & mydata$Dis=='Mental-Retardation' & mydata$u_r!= 'Rural'
& mydata$u_r!='Urban' & mydata$States!= 'INDIA',]
MyData_MentalRetardation_Main <- MyData_MentalRetardation_Main[order(MyData_MentalRetardation_Main$States),]
#Convert charecter data to numeric
MyData_MentalRetardation_Main$Main_p <- as.numeric(as.character(MyData_MentalRetardation_Main$Main_p))
MyData_MentalRetardation_Main$Main_m <- as.numeric(as.character(MyData_MentalRetardation_Main$Main_m))
MyData_MentalRetardation_Main$Main_f <- as.numeric(as.character(MyData_MentalRetardation_Main$Main_f))
#calculate number per 100 of Main population
MyData_MentalRetardation_Main$Main_male <- (sprintf("%.f", MyData_MentalRetardation_Main$Main_m * 100/MyData_MentalRetardation_Main$Main_p))
MyData_MentalRetardation_Main$Main_female <- sprintf("%.f", MyData_MentalRetardation_Main$Main_f * 100/MyData_MentalRetardation_Main$Main_p)
#Draw the Map of india indicating Mental-Retarded Main disabled Male Workers per 100 Disabled Parsons in each state
map_9 <- gvisGeoChart(data = MyData_MentalRetardation_Main, locationvar = "States", colorvar = "Main_male",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "MentalRetared_Male")
#Draw the Map of india indicating Mental-Retarded Main Disabled Female Workers per 100 Disabled Parsons in each state
map_10 <- gvisGeoChart(data = MyData_MentalRetardation_Main, locationvar = "States", colorvar = "Main_female",
options = list(region = "IN",domain = 'IN', displayMode = "regions",resolution="provinces",
width = 600, height = 400),chartid = "MentalRetared_Female")
plot(gvisMerge(map_9,map_10, horizontal = 'TRUE', chartid ="Mental-Retardation" ))
#Drawing Column Chart
MyData_MentalRetardation_Main$Main_male <- as.numeric(as.character(MyData_MentalRetardation_Main$Main_male))
MyData_MentalRetardation_Main$Main_female <- as.numeric(as.character(MyData_MentalRetardation_Main$Main_female))
col5 <- gvisColumnChart(MyData_MentalRetardation_Main, xvar = "States", yvar = c("Main_male", "Main_female"))
plot(col5)