-
Notifications
You must be signed in to change notification settings - Fork 6
/
ui.R
159 lines (136 loc) · 5.91 KB
/
ui.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
source("R/dkdfinfo.r")
source("R/dkgraph.r")
source("R/dkutils.r")
# to run
# shiny:::runApp("../shiny-explorer")
# shiny:::runApp("../shiny-explorer", launch.browser = rstudio::viewer)
# a very ugly hack as can't send more data than character vectors to selectizeInput therefore need to encode the field info in the label and extract it
# NB: also need to strip the field info when
selectizeRenderStr = "
{
item:function(item,escape) {
return '<div><span class=\"selectize-numitem\">' + escape((item.value).split('/')[0]) + '</span></div>';
},
option:function(item,escape) {
return '<div><span class=\"selectize-name\">' + escape((item.label).split('/')[0]) + '</span><span class=\"selectize-caption\">' + escape((item.label).split('/')[1]) + '</span></div>';
}
}"
# for testing logistic regression
#mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
# Define UI for dataset viewer application
shinyUI(navbarPage("Shiny-Explorer", position="fixed-top",
tabPanel("Explorer", icon=icon("list"),
sidebarLayout(
sidebarPanel(
# header includes
includeCSS("www/css/dkknitr.css"),
includeCSS("www/css/hover.css"),
includeScript("www/js/jquery-ui-1.10.3.custom.min.js"),
includeScript("www/js/jquery.sparkline.min.js"),
includeScript("www/js/highlight.pack.js"),
includeScript("www/js/toc.js"),
jsCodeHandler(), # for sending custom JS code to execute
tags$style(type="text/css", "body {padding-top: 70px;}"), # stop fixed-top navbar from overlay body content
h3("Variable Selection"),
wellPanel(
selectInput("dataset", "Dataframe:", choices = getDataFrames()),
p(helpText("Choose the desired fields in the dropdowns",
"and click Analyse to show an analysis."))
),
accordion("fieldsAccordion",
accordionPanel("Numerics",
selectizeInput("numerics", label="", choices=NULL, selected="", multiple=T, #NB: choices is filled by observing input$dataset
options=list(placeholder="Select numeric(s)", dropdownParent = "body", plugins=list(remove_button="", drag_drop=""),
labelField="label", render = I(selectizeRenderStr))), expanded=T),
accordionPanel("Factors",
selectizeInput("factors", label="", choices=NULL, selected="", multiple=T,
options=list(placeholder="Select factor(s)", dropdownParent = "body", plugins=list(remove_button="", drag_drop=""),
labelField="label", render = I(selectizeRenderStr)))),
accordionPanel("Dates",
selectizeInput("dates", label="", choices=NULL, selected="", multiple=T,
options=list(placeholder="Select date(s)", dropdownParent = "body", plugins=list(remove_button="", drag_drop=""),
labelField="label", render = I(selectizeRenderStr)))),
accordionPanel("Logicals",
selectizeInput("logicals", label="", choices=NULL, selected="", multiple=T,
options=list(placeholder="Select logical(s)", dropdownParent = "body", plugins=list(remove_button="", drag_drop="") )))
),
accordion("optionsAccordion",
accordionPanel("Options",
checkboxInput("chkggtheme", "Classic ggplots theme"))),
p(
# use actionButton rather than submitButton so that changing the dataframe dropdown automatically updates the field selects
actionButton("go",strong("Analyse"), class="hvr-icon-spin"), #icon("play")),
actionButton("deleteSelections", "Clear Selections", class="hvr-icon-sink-away") #icon("trash-o"))
)
), # sidebarPanel
mainPanel(
tabsetPanel(id="mainPanelTabset",
tabPanel("Variables", #tabsetPanel(id="summaryTabset",
h4("Numerics"),
tableOutput("numericInfo"),
h4("Factors"),
tableOutput("factorInfo"),
h4("Dates"),
tableOutput("dateInfo"),
h4("Logicals"),
tableOutput("logicalInfo")
# ,plotOutput("tabplot")
),
navbarMenu("Data",
tabPanel("TabPlot",
checkboxInput("limittabplot", label="Show selected variables only"),
plotOutput("mytabplot")
),
tabPanel("Table",
dataTableOutput("mydt")
),
tabPanel("PivotTable",
rpivotTableOutput("pivotTable"))
),
tabPanel("Analysis",
htmlOutput("analysis")
),
tabPanel("Source",
aceEditor("acermd", mode="markdown"))
)
) # mainPanel
) # sidebarLayout
), # tabPanel(Explorer)
navbarMenu("Import", icon=icon("list"),
tabPanel("Excel", icon=icon("list"),
sidebarLayout(
sidebarPanel(
h3("Data Import"),
wellPanel(
h4("Excel .xls/.xlsx:"),
tags$hr(),
fileInput('importFile', label=NULL, accept=c('.xls','.xlsx')),
selectInput("excelsheets", "Sheet:", choices = c()),
textInput("xlsdataframe", "DataFrame Name:", "myxlsdf"),
actionButton("assignxls", "Assign to DF")
)
),
mainPanel()
)
),
tabPanel("CSV", icon=icon("list"),
sidebarLayout(
sidebarPanel(
h3("Data Import"),
wellPanel(
h4("CSV:"),
tags$hr(),
fileInput('importFile', label=NULL, accept=c('.xls','.xlsx')),
textInput("csvdataframe", "DataFrame Name:", "mycsvdf"),
actionButton("assigncsv", "Assign to DF")
)
),
mainPanel()
)
)
), # navbarMenu(Import)
navbarMenu("Tests", icon=icon("bar-chart"),
tabPanel("2 Sample"),
tabPanel("Correlation")
) # navbarMenu(Tests)
))