-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathui.R
More file actions
126 lines (76 loc) · 5.05 KB
/
ui.R
File metadata and controls
126 lines (76 loc) · 5.05 KB
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
packages_to_use <- c("shiny", "shinydashboard","shinythemes")
install_load <- function(packages){
to_install <- packages[!(packages %in% installed.packages()[, "Package"])] # identify unavailable packages
if (length(to_install)){ # install unavailable packages
install.packages(to_install, repos='http://cran.us.r-project.org', dependencies = TRUE) # install those that have not yet been installed
}
for(package in packages){ # load all of the packges
suppressMessages(library(package, character.only = TRUE))
}
}
install_load(packages_to_use)
dashboardPage(skin="black",
dashboardHeader(title=tags$em("Shiny prediction app", style="text-align:center;color:#006600;font-size:100%"),titleWidth = 800),
dashboardSidebar(width = 250,
sidebarMenu(
br(),
menuItem(tags$em("Upload Test Data",style="font-size:120%"),icon=icon("upload"),tabName="data"),
menuItem(tags$em("Download Predictions",style="font-size:120%"),icon=icon("download"),tabName="download")
)
),
dashboardBody(
tabItems(
tabItem(tabName="data",
br(),
br(),
br(),
br(),
tags$h4("With this shiny prediction app, you can upload your data and get back predictions.
The model is a Regularized Logistic Regression that predicts whether microchips from a
fabrication plant passes quality assurance (QA). During QA, each microchip goes through various
tests to ensure it is functioning correctly. Suppose you are the product manager of the
factory and you have the test results for some microchips on two different tests.
From these two tests, you would like to determine whether the microchips should be accepted or rejected.", style="font-size:150%"),
br(),
tags$h4("To predict using this model, upload test data in csv format (you can change the code to read other data types) by using the button below.", style="font-size:150%"),
tags$h4("Then, go to the", tags$span("Download Predictions",style="color:red"),
tags$span("section in the sidebar to download the predictions."), style="font-size:150%"),
br(),
br(),
br(),
column(width = 4,
fileInput('file1', em('Upload test data in csv format ',style="text-align:center;color:blue;font-size:150%"),multiple = FALSE,
accept=c('.csv')),
uiOutput("sample_input_data_heading"),
tableOutput("sample_input_data"),
br(),
br(),
br(),
br()
),
br()
),
tabItem(tabName="download",
fluidRow(
br(),
br(),
br(),
br(),
column(width = 8,
tags$h4("After you upload a test dataset, you can download the predictions in csv format by
clicking the button below.",
style="font-size:200%"),
br(),
br()
)),
fluidRow(
column(width = 7,
downloadButton("downloadData", em('Download Predictions',style="text-align:center;color:blue;font-size:150%")),
plotOutput('plot_predictions')
),
column(width = 4,
uiOutput("sample_prediction_heading"),
tableOutput("sample_predictions")
)
))
)))