-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject_presentation_poverty.Rmd
499 lines (361 loc) · 13.5 KB
/
project_presentation_poverty.Rmd
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
---
title: "MAT 381E-Final Presentation "
subtitle: "Children Poverty in the World"
author: "Ali Alperen Usta & Kaan Kaymaz<br/>poverty"
institute: "Department of Mathematics<br/>Istanbul Technical University"
date: "29/01/2022"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
# Poverty
- **Poverty** is a state or condition in which a person or community lacks the financial resources and essentials for a minimum standard of living. Poverty means that the income level from employment is so low that basic human needs can't be met. Poverty-stricken people and families might go without proper housing, clean water, healthy food, and medical attention.
- Children are more than twice as likely to live in poverty than adults. Children from the poorest households die at twice the rate of their better-off peers.
---
# Indicators of Poverty
According to Multidimensional Poverty Index which is specified in surveys of Sustainable Development Solutions Network (SDSN), there are 9 items that are indicators of poverty.
1. Adult or child malnourishment
2. Disrupted or curtailed schooling (a minimum of years 1-8)
3. The absence of any household member who has completed 6 years of schooling
4. Child mortality within the household within the last 5 years
5. Lack of access to safe drinking water
6. Lack of access to basic sanitation services
7. Lack of access to clean cooking fuel
8. Lack of basic modern assets (radio, TV, telephone, computer, bike, motorbike, etc.)
9. Lack of access to reliable electricity
---
.pull-left[
# Aim of Project
- This project aims to examine the living conditions, economic situation and educational status of children in the world. With this project, it is aimed to point out that **child poverty** is a huge problem for the world.
- The project examines the connection of these problems with the level of development of the countries according to different data such as mortality, education, water services.
]
.pull-right[
```{r, echo=FALSE}
knitr::include_graphics("https://www.unicef.org/sites/default/files/styles/hero_mobile/public/UNI112437.jpg?itok=gJh6vbn0")
```
- The purpose of the project is achieved by transforming the relevant data into graphical information.
]
---
## Introduction to Data
- There are 3 basic data used in this project to detect child poverty.
1. Mortality
2. Education
3. Water Services
- Data was collected from UNICEF, an organization dedicated to reducing child poverty around the world.
- The data show the situation of the countries according to the researches made according to certain years.
- It can be can accessed the data from the reference section on the last page.
---
#Data Preparation
```{r, eval=FALSE}
library(readxl)
# This library is used to import data to R.
library(tidyverse)
library(tidyr)
library(dplyr)
# These libraries are used to manipulate data.
library(ggplot2)
library(patchwork)
# These libraries are used to visualize data.
library(sf)
library(leaflet)
# These libraries are used to use spatial data.
```
---
### Importing Data
```{r, eval=FALSE}
mortality<-read_excel("data/Table-2-Child-Mortality-EN.xlsx")
str(mortality)
```
```{r,eval=FALSE}
education<-read_excel("data/Table-10-Education-EN.xlsx")
```
```{r,eval=FALSE}
wash<-read_excel("data/Table-13-WASH-EN.xlsx")
```
```{r,eval=FALSE}
dev_data<-read_excel("data/comparedata.xlsx")%>%
slice(-c(1))%>%
select("Development Regions")
```
---
# Dirty Data
```{r, echo=FALSE}
knitr::include_graphics("image/mortality_first.jpeg")
```
---
## Cleaning and Reshaping
The code that manipulates the mortality data is below
```{r,eval=FALSE}
not_all_na <- function(mortality) any(!is.na(mortality))
mortality_tidy <-
mortality %>%
filter_all(any_vars(! is.na(.))) %>%
select(where(not_all_na)) %>%
select(1:4|6:9|13:14) %>%
rename("Countries"="TABLE 2. CHILD MORTALITY",
"Under_5_1990"="...2",
"Under_5_2000"="...4",
"Under_5_2018"="...6",
"Under_5_male_rate_2018"="...10",
"Under_5_female_rate_2018"="...12",
"Infant_1990"="...14",
"Infant_2018"="...16",
"Dying_5_14_1990"="...24",
"Dying_5_14_2018"="...26") %>%
slice(c(3:204)) %>%
mutate(dev_data,.after="Countries")
```
---
# Tidy Data
```{r, echo=FALSE}
knitr::include_graphics("image/mortality_tidy.jpeg")
```
---
# Data Visualization
5 different types of graphics were used in this project.
- **The graphs used are:**
- Boxplot
- Pie Chart
- Scatter Graph
- Spatial Mapping
- Bar Graph
---
## Boxplot Code
```{r,eval=FALSE,warning=FALSE}
graph_1990 <-
mortality_tidy %>%
ggplot(aes(x=`Development Regions`,y=Under_5_1990)) +
geom_boxplot(fill="#34967d") +
labs(x = "Development Levels", y = "Deaths",
title = "Under-5 Mortality Rate in 1990 (per 1000 live births)")+
theme(axis.title =element_text(size = 15, color = "#ad4e4e", face = "italic"),
axis.text = element_text(size = 11, color = "#616d77", face="bold"),
plot.title = element_text(size = 15, color="#8f3d3e" ,face = "italic"),
panel.background = element_rect(fill="coral"),
plot.background = element_rect(fill="#cedfd5"))
graph_1990
```
---
class:center
## Boxplot
.pull-left[
```{r, echo=FALSE}
knitr::include_graphics("image/image1.png")
```
```{r, echo=FALSE}
knitr::include_graphics("image/image3.png")
```
]
.pull-right[
```{r, echo=FALSE}
knitr::include_graphics("image/image2.png")
```
]
---
## PieChart Code
```{r,eval=FALSE}
pie1<-ggplot(mort_1,aes(x="",y=avg_Under_5_female,fill=`Development Regions`))+
geom_bar(width=0.7,stat="identity")+
labs(y="y", title="Mean of Under-5 Female Mortality" ,subtitle="(deaths per 1000 live births)")+
theme(plot.title = element_text(size = 14, color="red",face = "bold" )) +
geom_label(aes(label=avg_Under_5_female),
position = position_stack(vjust = 0.5),
show.legend = FALSE) +
scale_fill_brewer(palette="PuRd")+
theme_void() +
coord_polar(theta = "y")
#pie2 same
pie1+pie2
```
---
## PieChart
```{r, echo=FALSE}
knitr::include_graphics("image/image4.png")
```
---
## Scatter Graph Code
```{r, eval=FALSE}
least_graph1<-
mortality_tidy %>%
filter(`Development Regions` == "Least Developed") %>%
mutate(`Countries`=fct_reorder(`Countries`,Under_5_1990))%>%
ggplot(aes(Under_5_1990,`Countries`))+
labs(y="Least Developed Countries",x="Mortality Rate",
title="Under-5 Mortality Rate in 1990",
subtitle="(deaths per 1000 live)")+
geom_point(color="turquoise4",shape=19) +
theme(axis.text.x = element_text(size=11,face="bold",color="#aa5a4f"),
axis.text.y = element_text(size=5,face="bold",color="#aa5a4f"),
axis.line.x = element_line(color="black"),
axis.line.y = element_line(color="black"),
axis.title.y=element_text(color="darkslategrey"),
axis.title.x=element_text(color="gray42"),
plot.title=element_text(color="#407328",hjust=0.5,size=16),
plot.subtitle=element_text(color="#407328",hjust=0.5,size=16),
panel.background = element_rect(fill="#C8BA5B"),
plot.background = element_rect(fill="#cedfd5"))+
scale_x_continuous(breaks=seq(0,400,20))
least_graph1
```
---
## Scatter Plot
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image5.png")
```
---
## Scatter Plot
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image6.png")
```
---
## Scatter Plot
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image7.png")
```
---
## Scatter Plot
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image8.png")
```
---
## Scatter Plot
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image9.png")
```
---
## Scatter Plot
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image10.png")
```
---
```{r,include=FALSE}
devtools::install_github("thomasp85/patchwork")
```
```{r,include=FALSE}
library(tidyverse)
library(tidyr)
library(dplyr)
library(readxl)
library(ggplot2)
library(patchwork)
library(sf)
library(rmarkdown)
library(leaflet)
```
```{r,include=FALSE}
dev_data<-read_excel("data/comparedata.xlsx")%>%
slice(-c(1))%>% ##This data is used to pull "development levels" data.
select("Development Regions")
```
## Spatial Data
```{r, eval=FALSE}
world_data<- st_read("data/world-administrative-boundaries.shp")
```
```{r, eval=FALSE}
world_data_1<-world_data %>%
rename(Countries="name")
```
```{r, eval=FALSE}
world_data_2<-world_data_1 %>%
select(Countries) %>%
arrange(Countries)
```
```{r, eval=FALSE}
education_tidy <- education_tidy %>%
arrange(Countries)
```
```{r, eval=FALSE}
merged_data_1<-merge(world_data_2,education_tidy)
```
---
## Spatial Mapping
```{r, eval=FALSE}
out_of_school_color <- colorFactor(
palette=c("#025F06","#579C5A","#88A389"),
domain= merged_data_1$`Development Regions`,
levels = c("More Developed","Less Developed","Least Developed"),
ordered = TRUE)
```
```{r, eval=FALSE}
out_of_school_labels <-
sprintf("<strong>%s</strong><br>%s<br>Out of School primary male: %s <br> Out of School primary female:%s",merged_data_1$Countries,merged_data_1$`Development Regions`,
merged_data_1$Out_of_school_primary_male,
merged_data_1$Out_of_school_primary_female) %>%
lapply(htmltools::HTML)
```
```{r, eval=FALSE}
out_of_school_map <- merged_data_1 %>% leaflet() %>%
addPolygons
(stroke=TRUE,color = "white",weight = 1,label=out_of_school_labels,
fillColor = ~out_of_school_color(`Development Regions`),
fillOpacity = 0.7)
out_of_school_map
```
---
## Bar Graph Code
```{r,eval=FALSE,warning=FALSE}
wash_least_plot<-ggplot(wash_tidy_1,aes(reorder(Countries,Total_basic_drinking_water_services),
Total_basic_drinking_water_services,
fill=as.factor(Countries)))+
geom_col(color="white")+
theme_bw()+
coord_flip(clip = "off", expand = FALSE)+
guides( fill = FALSE) +
labs(title="Total Basic Drinking Water Services for Least Developed Countires",
y="Total water services ", x="Least Developed Countries")+
geom_text(fontface = "bold",color="#2B3D5D",size=3,aes(label = paste(Total_basic_drinking_water_services,"")), hjust = 1)+
theme(
plot.title=element_text(size=11, hjust=0.5, face="bold", colour="#A330D5", vjust=-1),
axis.title.y=element_text(color="darkslategrey"),
axis.title.x=element_text(color="#6E76F0"),
panel.background = element_rect(fill="#EAF0DA"),
plot.background = element_rect(fill="#B4F7C7"))
wash_least_plot
```
---
## Bar Graph
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image_wash1.png")
```
---
## Bar Graph
```{r, echo=FALSE,out.height='80%',out.width='100%'}
knitr::include_graphics("image/image_wash2.png")
```
---
## Challenges
After clearing the data, the correct result for the graphs could not be obtained. Because, number values were available as character structure. The problem was fixed by doing the following actions.
```{r, eval=FALSE ,warning=FALSE}
mortality_tidy[,1] <- as.factor(unlist(mortality_tidy[,1]))
mortality_tidy[,2] <- as.factor(unlist(mortality_tidy[,2]))
mortality_tidy[,3] <- as.numeric(unlist(mortality_tidy[,3]))
mortality_tidy[,4] <- as.numeric(unlist(mortality_tidy[,4]))
mortality_tidy[,5] <- as.numeric(unlist(mortality_tidy[,5]))
mortality_tidy[,6] <- as.numeric(unlist(mortality_tidy[,6]))
mortality_tidy[,7] <- as.numeric(unlist(mortality_tidy[,7]))
mortality_tidy[,8] <- as.numeric(unlist(mortality_tidy[,8]))
mortality_tidy[,9] <- as.numeric(unlist(mortality_tidy[,9]))
mortality_tidy[,10] <- as.numeric(unlist(mortality_tidy[,10]))
mortality_tidy[,11] <- as.numeric(unlist(mortality_tidy[,11]))
```
---
## Conclusion
- It has been worked on mortality, education and water data.
- Importing, cleaning, mutating, reshaping and visualization steps were applied.
- In addition to the interim report, education and water data were analyzed.
## Results
- As a result, child poverty is a worldwide problem.
- Based on the data, it can be said that poverty in developed countries is much less than in underdeveloped countries.
---
## References
[1] [UNICEF Table](https://data.unicef.org/resources/dataset/sowc-2019-statistical-tables/)
[2] [Spatial Data](https://public.opendatasoft.com/explore/dataset/world-administrative-boundaries/export/)
[3] [UNICEF Data Warehouse](https://data.unicef.org/resources/data_explorer/unicef_f/?ag=UNICEF&df=GLOBAL_DATAFLOW&ver=1.0&dq=.ED_15-24_LR..&startPeriod=2016&endPeriod=2022)
[4] [UNICEF Research](https://data.unicef.org/topic/child-poverty/overview/)
[5] [Graph Implementations](https://ivelasq.rbind.io/blog/other-geoms/)
[6] [Solution of Poverty](https://cpag.org.uk/child-poverty/solutions-poverty)
[7] [Slides with Rmarkdown](https://www.youtube.com/watch?v=3n9nASHg9gc)