aephidayatuloh commited on
Commit
6f9b128
·
1 Parent(s): f40ecba

change to shinywidgets

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -1
  2. app.R +27 -18
Dockerfile CHANGED
@@ -17,7 +17,8 @@ RUN install2.r --error \
17
  xgboost \
18
  recipes \
19
  echarts4r \
20
- shiny
 
21
 
22
  # Install development packages from GitHub
23
  RUN installGithub.r \
 
17
  xgboost \
18
  recipes \
19
  echarts4r \
20
+ shiny \
21
+ shinyWidgets
22
 
23
  # Install development packages from GitHub
24
  RUN installGithub.r \
app.R CHANGED
@@ -4,6 +4,7 @@ library(parsnip)
4
  library(workflows)
5
  library(xgboost)
6
  library(shiny)
 
7
  library(bslib)
8
  library(dplyr)
9
  library(echarts4r)
@@ -18,28 +19,36 @@ model <- readRDS("MoE-model.rds")
18
  ui <- page_sidebar(
19
  theme = bs_theme(bootswatch = "minty"),
20
  title = "Pathway of Success",
21
- sidebar = sidebar(
22
- checkboxInput("playgroup", "Playgroup"),
23
- checkboxInput("preelementary_school", "Pre-Elementary School"),
24
- checkboxInput("gov_scholarship_holder", "Gov. Scholarship Holder"),
 
25
  numericInput("home_sch_dist", "Home to School Distance", value = 3, min = 0),
26
- checkboxInput("sex", "Male?"),
27
  selectInput("school_location", "School Location", choices = c("Rural", "Urban")),
28
- checkboxInput("parents_spc_need", "Parent have special needs?"),
29
- selectInput("highsch_major", "Highschool Major",
30
- choices = c("Natural Science", "Social Sciences", "Language Studies")),
31
  selectInput("parents_occupation_category", "Parents Occupation Category",
32
  choices = c("Civil Servants", "Labor Workers", "Private Employee")),
33
  numericInput("household_income", "Household Income", 4000000, min = 0, max = 19949598),
34
  selectInput("parents_education_level_cat", "Parent Education Level",
35
- choices = c("Bachelor", "Diploma", "Master/Doctorate", "Senior Highschool", "Junior Highschool", "Elementary School", "Unschooled")),
36
- numericInput("math_score", "Math Score", 50, min = 0, max = 100),
37
- numericInput("science_score", "Science Score", 50, min = 0, max = 100),
38
- numericInput("english_score", "English Score", 50, min = 0, max = 100),
39
- numericInput("indonesian_score", "Bahasa Indonesia Score", 50, min = 0, max = 100),
40
- numericInput("social_score", "Social Score", 50, min = 0, max = 100),
41
- selectInput("university", "University", choices = c("Private", "Public"))
42
-
 
 
 
 
 
 
 
 
 
43
  ),
44
  # tableOutput("tblout")
45
  echarts4rOutput("gpa_plot")
@@ -74,9 +83,9 @@ server <- function(input, output, session) {
74
  augment(x = model, new_data = x) |>
75
  arrange(desc(.pred)) |>
76
  slice_head(n = 5) |>
77
- mutate(pred_GPA = round(.pred, 2)) |>
78
  e_charts(univ_major) |>
79
- e_bar(pred_GPA, label = list(show = TRUE)) |>
80
  e_flip_coords() |>
81
  e_y_axis(inverse = TRUE)
82
  }
 
4
  library(workflows)
5
  library(xgboost)
6
  library(shiny)
7
+ library(shinyWidgets)
8
  library(bslib)
9
  library(dplyr)
10
  library(echarts4r)
 
19
  ui <- page_sidebar(
20
  theme = bs_theme(bootswatch = "minty"),
21
  title = "Pathway of Success",
22
+ sidebar = sidebar(width = "20%",
23
+ h5("Input"),
24
+ fluidRow(prettySwitch("playgroup", "Playgroup", fill = TRUE, status = "primary"),
25
+ prettySwitch("preelementary_school", "Pre-Elementary School", fill = TRUE, status = "primary"),
26
+ prettySwitch("gov_scholarship_holder", "Gov. Scholarship Holder", fill = TRUE, status = "primary"),
27
  numericInput("home_sch_dist", "Home to School Distance", value = 3, min = 0),
28
+ prettySwitch("sex", "Male?", fill = TRUE, status = "primary"),
29
  selectInput("school_location", "School Location", choices = c("Rural", "Urban")),
30
+ prettySwitch("parents_spc_need", "Parent have special needs?", fill = TRUE, status = "primary"),
 
 
31
  selectInput("parents_occupation_category", "Parents Occupation Category",
32
  choices = c("Civil Servants", "Labor Workers", "Private Employee")),
33
  numericInput("household_income", "Household Income", 4000000, min = 0, max = 19949598),
34
  selectInput("parents_education_level_cat", "Parent Education Level",
35
+ choices = c("Bachelor", "Diploma", "Master/Doctorate", "Senior Highschool", "Junior Highschool", "Elementary School", "Unschooled"))
36
+ ),
37
+ fluidRow(
38
+ selectInput("highsch_major", "Highschool Major", width = "60%",
39
+ choices = c("Natural Science", "Social Sciences", "Language Studies")),
40
+ numericInput("math_score", "Math Score", 50, min = 0, max = 100, width = "39%")
41
+ ),
42
+ fluidRow(
43
+ numericInput("science_score", "Science Score", 50, min = 0, max = 100, width = "48%"),
44
+ numericInput("english_score", "English Score", 50, min = 0, max = 100, width = "48%")
45
+ ),
46
+ fluidRow(
47
+ numericInput("indonesian_score", "B. Indonesia Score", 50, min = 0, max = 100, width = "48%"),
48
+ numericInput("social_score", "Social Score", 50, min = 0, max = 100, width = "48%")
49
+ ),
50
+ selectInput("university", "University", choices = c("Private", "Public")),
51
+ hr()
52
  ),
53
  # tableOutput("tblout")
54
  echarts4rOutput("gpa_plot")
 
83
  augment(x = model, new_data = x) |>
84
  arrange(desc(.pred)) |>
85
  slice_head(n = 5) |>
86
+ mutate(predict_GPA = round(.pred, 2)) |>
87
  e_charts(univ_major) |>
88
+ e_bar(predict_GPA, label = list(show = TRUE)) |>
89
  e_flip_coords() |>
90
  e_y_axis(inverse = TRUE)
91
  }