-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.Rmd
503 lines (378 loc) · 15 KB
/
index.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
500
501
502
---
title: "The Statistics of Early Childhood Education in Indonesia"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
theme: united
source_code: embed
---
```{r setup, include=FALSE}
pacman::p_load(rio, here, tidyverse, maps, mapdata, ggthemes, ggrepel, rgdal,raster, viridis,sf,terra, colorspace, flexdashboard, plotly,janitor, maptools,ggthemes, viridis,forcats, shiny,htmltools)
```
```{r include=FALSE}
#Load Indonesia shapefile
#Load Province name
name <- import(here("data", "name.xlsx"))
name$id <- as.character(name$id)
#Load Indonesia shapefile
idn_shape2 <- readOGR(here("data","smallest","idn_admbnda_adm1_bps_20200401.shp"))
st_drivers()
idn_shape_df <- fortify(idn_shape2)
head(idn_shape_df)
idn <- left_join(idn_shape_df, name)
#Load ECE Data
stat <- import(here("data","stat.xlsx")) %>%
clean_names() %>%
mutate(across(setdiff(names(select(., where(is.character))), 'province'), as.numeric))
dat <- left_join(idn, stat)
str(stat)
growth <- import(here("data","growth.xlsx")) %>%
pivot_longer(cols=2:11,
names_to = "year",
values_to = "count")
```
```{r include=FALSE}
year <- stat %>%
select(province, all_2017_2018:all_2020_2021, stud_2017_2018:stud_2020_2021, teacher_2017_2018:teacher_2020_2021) %>%
pivot_longer(cols = 2:13,
names_to = c("type", "year"),
names_sep = "_",
values_to = "number") %>%
mutate(type=recode(type,
all = "ECE Program",
stud="Student",
teacher="Teacher"))
```
# Overview
Sidebar Title {.sidebar}
--------------
**General information about ECE Programs in Indonesia**
The First Page of this dashboard contains overall nationwide data about Total number of ECE Programs, total number of students enrolled in all ECE programs, total numbers of ECE Teachers and Facilitators, and total number of classrooms.
```{r include=FALSE}
longdat<- dat %>%
select(province, long, lat, group, "ECE centers"=institution, "Students"=participants, "Teachers"=teacher_facilitator) %>%
pivot_longer(cols=5:7,
names_to = "type",
values_to = "count")
```
```{r echo=FALSE}
selectInput("data0", label = h3("Select Data to Show"),
choices = list("Number of ECE Centers" = "ECE centers", "Number of Students Enrolled" = "Students", "Number of Teachers" = "Teachers"),
selected="institution")
selectdata1 <- reactive(as.character(input$data0))
```
*Data source:*
Data is taken from the 2020/2021 Annual ECE Statistics Report issued by the Ministry of Education and Cultural. This data reflects ECE Programs statistics in Indonesia as off 30 November 2020.
-------------
Column {.tabset data-width=700}
-----------------------------------------
###
```{r echo=FALSE}
renderPlotly({
longdat %>%
filter(type == selectdata1())%>%
ggplot(aes(x = long, y = lat, group = group)) +
geom_polygon(aes(x=long,y=lat, group=group, fill=count, text=province), color='black')+
scale_fill_viridis_c(option = "magma", direction=-1)+
ggthemes::theme_map(base_size=8)+
ggtitle(paste("Overview Number of",input$data0, "by Province in Indonesia"))+
theme(strip.background = element_blank(),
legend.position ="bottom",
# legend.direction = "horizontal",
legend.title = element_text(size = 6),
legend.text = element_text(size = 6),
legend.key.size = unit(1, "lines"),
plot.title.position = "plot",
text=element_text(family= "sans"),
plot.title = element_text(size=15, color = "#410A75",face="bold"),
plot.subtitle = element_text(face="italic"),
plot.caption = element_text(color ="gray30",hjust = 0),
axis.title = element_text(face = "bold"))+
labs(x="",
y="")
})
```
# Student to Teacher Ratio
Sidebar Title {.sidebar data-width=300}
--------------
The Second Page of this dashboard contains student to teacher ratio by type of ECE Programs aggregated in Province level. There are two main types of ECE Program, Non-formal ECE and Formal ECE.
There are three types of Non-Formal ECE:
+ Daycare for 0-6 years old with the Priority for 0-4 years old
+ Playgroup for 2-6 years old with Priority for 3-4 years old
+ Integrated ECE for 0-6 years old
And only one type of Formal ECE
+ Kindergarten for 4-6 years old with priority for 5-6 years old
Permendikbud 137 year 2014 about National ECE Standards regulates the maximum student per teacher ratio based on children age:
+ aged 0-2 = 1:4
+ aged 2-4 = 1:8
+ aged 4-6 = 1:15
```{r include=FALSE}
ratio<-dat %>%
select(province,
long,
lat,
group,
"Kindergarten"=tk_stu_teacher,
"Playgroup"=kb_stu_teach,
"Daycare"=tpa_stu_teach,
"Integrated ECD"=sps_stu_teach) %>%
pivot_longer(cols=5:8,
names_to = "type",
values_to = "count")
```
```{r echo=FALSE}
selectInput("dataratio", label = h3("Select Type of ECE"),
choices = unique(ratio$type),
selected="Kindergarten")
selectdataratio <- reactive(as.character(input$dataratio))
```
-------------
Column {.tabset data-width=700}
-----------------------------------------
### Student to Teacher Ratio
```{r echo=FALSE}
renderPlotly({
ratio %>%
filter(type == selectdataratio())%>%
ggplot(aes(x = long, y = lat, group = group)) +
geom_polygon(aes(x=long,y=lat, group=group, fill=count, text=province), color='black')+
scale_fill_viridis_c(option = "magma", direction=-1)+
ggthemes::theme_map(base_size=8)+
ggtitle(paste("Student to Teacher Ratio for",input$dataratio,"program by Province in Indonesia"))+
theme(strip.background = element_blank(),
legend.position ="bottom",
legend.title = element_text(size = 6),
legend.text = element_text(size = 6),
legend.key.size = unit(1, "lines"),
plot.title.position = "plot",
text=element_text(family= "sans"),
plot.title = element_text(size= 15, face="bold", color = "#410A75"),
plot.subtitle = element_text(face="italic"),
plot.caption = element_text(color ="gray30",hjust = 0),
axis.title = element_text(face = "bold"))
})
```
# Class-size
Sidebar Title {.sidebar data-width=300}
--------------
This page displays class size data by type of ECE Programs aggregated in Province level.
```{r include=FALSE}
class<-dat %>%
select(province,
long,
lat,
group,
"Kindergarten"=tk_classsize,
"Playgroup"=kb_classsize,
"Daycare"=tpa_classsize,
"Integrated ECD"=sps_classsize) %>%
pivot_longer(cols=5:8,
names_to = "type",
values_to = "count")
```
```{r echo=FALSE}
selectInput("dataclass", label = h3("Select Type of ECE"),
choices = unique(class$type),
selected="Kindergarten")
selectclass <- reactive(as.character(input$dataclass))
```
-------------
Column {.tabset data-width=700}
-----------------------------------------
### Class-Size
```{r echo=FALSE}
renderPlotly({
class%>%
filter(type == selectclass())%>%
ggplot(aes(x = long, y = lat, group = group)) +
geom_polygon(aes(x=long,y=lat, group=group, fill=count, text=province), color='black')+
scale_fill_viridis_c(option = "magma", direction=-1)+
ggtitle(paste("Class-size for",input$dataclass, "Program by Province in Indonesia"))+
ggthemes::theme_map(base_size=8)+
theme(strip.background = element_blank(),
legend.position ="bottom",
# legend.direction = "horizontal",
legend.title = element_text(size = 6),
legend.text = element_text(size = 6),
legend.key.size = unit(1, "lines"),
plot.title.position = "plot",
text=element_text(family= "sans"),
plot.title = element_text(size = 15, color = "#991D85", face="bold"),
plot.subtitle = element_text(face="italic"),
plot.caption = element_text(color ="gray30",hjust = 0),
axis.title = element_text(face = "bold"))
})
```
# National Level
Sidebar Title {.sidebar}
--------------
There are three types of Non-Formal ECE:
+ Daycare (Tempat Penitipan Anak) for 0-6 years old with the Priority for 0-4 years old
+ Playgroup (Kelompok Bermain) for 2-6 years old with Priority for 3-4 years old
+ Integrated ECE (Satuan Paud Sejenis) for 0-6 years old
And only one type of Formal ECE
+ Kindergarten (Taman Kanak-kanak/ Raudatul Athfal) for 4-6 years old with priority for 5-6 years old
*Data source:*
Data is taken from Annual ECE Statistics Report issued by the Ministry of Education and Cultural year 2011-2020. This data reflects ECE Programs statistics in Indonesia as off 30 November 2020.
```{r}
selectInput("type", label = h3("Type of ECE Program"),
#choices = unique(growth$type),
choices = list("All"="All","Kindergarten" = "Kindergarten", "Playgroup" = "Playgroup","Daycare" = "Daycare","Integrated ECD" = "Integrated ECD"),#c("All","Kindergarten","Playgroup","Daycare","Integrated ECD"),
selected = "All")#,
#multiple= TRUE)
```
-------------
Column {.tabset data-width=700}
-----------------------------------------
### Number of ECE Programs in National level by type
```{r echo=FALSE}
selecttype <- reactive(as.character(input$type))
```
```{r echo=FALSE}
renderPlotly({
growth %>%
filter(type %in% selecttype()) %>%
ggplot()+
geom_point(aes(year, count),stat= "identity", position = "identity",alpha = .5, size = 5,color = "#E3007C")+
geom_line(aes(year, count,group=type), color = "#E3007C",linewidth=1)+
ggtitle(paste("Total number of",input$type, "Program in Indonesia from 2011-2020"))+
theme(plot.title = element_text(size = 15, color = "#025193", face="bold"),
plot.title.position = "plot",
legend.position = "none",
axis.ticks=element_blank(),
panel.background = element_blank(),
axis.title.y = element_blank()
)
})
```
# Interactive by Province
Sidebar Title {.sidebar data-width=300}
--------------
This page is designed to visualize the Provincial Level Data for Number of ECE Program, Students, and Teachers across the year.
**Chart A** is the Within-Province visualization. Audience can select specific province and range of year data to preview.
<!-- In this chart, all three sub-data (Number of ECE center, Students, and Teachers) are included in one chart to allow the audience to compare the trend of growth throughout the year with the selected province. -->
```{r echo=FALSE}
selectInput("province", label =("Select Province"),
choices = unique(year$province),
selected = "DKI Jakarta")
sliderInput('year', label =('Select Year'), min=2017, max=2020,
value=2020, sep="")
selectprovince <- reactive(as.character(input$province))
selectyear <- reactive(as.numeric(input$year))
```
**Chart B** is the Between-Province visualization. Audience can select specific type of data (Number of ECE center, Students, and Teachers) and year to preview.
<!-- In this chart, audience can compare range of the raw numbers of each type of data variable between province. -->
```{r}
selectInput("data1", label =("Select Type of Data to Show"),
choices = list("ECE Centers" = "ECE Program", "Students Enrolled" = "Student", "Teachers" = "Teacher"),
selected="all")
selectdata <- reactive(as.character(input$data1))
selectInput("year1", label =("Select the Year"),
choices = unique(year$year),
selected="2017")
selectyear1 <- reactive(as.numeric(input$year1))
```
Column {data-width=300}
-----------------------------------------
### A. Individual Province Data: Number of Student enrolled, Teacher, & ECE center by Province from 2017-2020
```{r echo=FALSE}
renderPlotly ({year %>%
filter(province == selectprovince(),
year <= selectyear(),
type == "Student") %>%
ggplot(aes(year, number, fill= type, color=type))+
geom_bar(stat= "identity", position = "identity",alpha = .1, width = .2)+
geom_point(stat= "identity", position = "identity",alpha = .5, size=3)+
geom_line(aes(year, number, group=type), linewidth = 1)+
facet_wrap(~type)+
scale_color_manual(name= "",
values="#E3007C")+
scale_fill_manual(name= "",
values="#E3007C")+
labs(fill="")+
theme(plot.title.position = "plot",
legend.title=element_blank(),
legend.position= "none",
axis.ticks=element_blank(),
panel.background = element_blank(),
axis.title.y = element_blank(),
axis.title.x = element_blank())
})
```
### B
```{r}
renderPlotly ({year %>%
filter(province == selectprovince(),
year <= selectyear(),
type == "ECE Program") %>%
ggplot(aes(year, number, fill= type, color=type))+
geom_bar(stat= "identity", position = "identity",alpha = .1, width = .2)+
geom_point(stat= "identity", position = "identity",alpha = .5, size=3)+
geom_line(aes(year, number, group=type), linewidth = 1)+
facet_wrap(~type)+
scale_color_manual(name= "",
values='#025193')+
scale_fill_manual(name= "",
values='#025193')+
labs(fill="")+
theme(plot.title.position = "plot",
legend.title=element_blank(),
legend.position= "none",
axis.ticks=element_blank(),
panel.background = element_blank(),
axis.title.y = element_blank(),
axis.title.x = element_blank())
})
```
### C
```{r echo=FALSE}
renderPlotly ({year %>%
filter(province == selectprovince(),
year <= selectyear(),
type == "Teacher") %>%
ggplot(aes(year, number, fill= type, color=type))+
geom_bar(stat= "identity", position = "identity",alpha = .1, width = .2)+
geom_point(stat= "identity", position = "identity",alpha = .5, size=3)+
geom_line(aes(year, number, group=type), linewidth = 1)+
facet_wrap(~type)+
scale_color_manual(name= "",
values='#00906E')+
scale_fill_manual(name= "",
values='#00906E')+
labs(fill="")+
theme(plot.title.position = "plot",
legend.position= "none",
legend.title=element_blank(),
axis.ticks=element_blank(),
panel.background = element_blank(),
axis.title.y = element_blank(),
axis.title.x = element_blank())
})
```
Column {data-width=650}
-----------------------------------------
### B. Comparison Across Province: Number of Student enrolled, Teacher, & ECE center by Province from 2017-2020
```{r echo=FALSE}
renderPlotly ({
year %>%
filter(type == selectdata(),
year == selectyear1())%>%
ggplot()+
geom_bar(aes(number, fct_reorder(province, number), fill=number), stat = "identity")+
scale_x_continuous(expand = c(0,0))+
scale_fill_viridis_c(
option = "viridis", direction = -1)+
theme_minimal(base_size = 10) +
theme(axis.text.x=element_text(angle=45,hjust=1),
legend.key.size = unit(0.3, 'cm'),
panel.grid.minor=element_blank(),
plot.background=element_blank(),
panel.grid.major.x =element_blank()) +
labs(x="",
y="",
fill ="")+
coord_flip()
})
```