-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwidgetGallery.R
152 lines (116 loc) · 4.25 KB
/
widgetGallery.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
library(shiny)
ui <- fluidPage(
titlePanel("Widget Gallery"),
fluidRow(
column(6,
wellPanel(
h3("Select input"),
selectInput(inputId = "select",
label = "Selection",
choices = c("Duck, Duck, Goose", "Duck, Duck, Grey duck", "What the Duck?"),
selected = "Duck, Duck, Goose"),
p("Current Value:"),
verbatimTextOutput("selectOut")
)),
column(3,
wellPanel(
h3("Single checkbox"),
checkboxInput("checkbox", label = "Choice A",
value = TRUE),
p("Current Value:"),
verbatimTextOutput("checkboxOut")
)),
column(3,
wellPanel(
checkboxGroupInput("checkGroup",
label = h3("Checkbox group"),
choices = list("Choice 1" = 1, "Choice 2" = 2,
"Choice 3" = 3),
selected = 1),
p("Current Values:"),
verbatimTextOutput("checkGroupOut")
))
),
fluidRow(
column(4,
wellPanel(
dateInput("date", label = h3("Date input"), value = "2014-01-01"),
p("Current Value:"),
verbatimTextOutput("dateOut")
)),
column(4,
wellPanel(
dateRangeInput("dates", label = h3("Date range")),
p("Current Values:"),
verbatimTextOutput("datesOut")
)),
column(4,
wellPanel(
fileInput("file", label = h3("File input")),
p("Current Value:"),
verbatimTextOutput("fileOut")
))
),
fluidRow(
column(4,
wellPanel(
numericInput("num", label = h3("Numeric input"), value = 1),
p("Current Value:"),
verbatimTextOutput("numOut")
)),
column(4,
wellPanel(
radioButtons("radio", label = h3("Radio buttons"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1),
p("Current Values:"),
verbatimTextOutput("radioOut")
)),
column(4,
wellPanel(
h3("Action button"),
actionButton("action", label = "Action"),
p("Current Value:"),
verbatimTextOutput("actionOut")
))
),
fluidRow(
column(4,
wellPanel(
sliderInput("slider1", label = h3("Slider"), min = 0, max = 100,
value = 50),
p("Current Value:"),
verbatimTextOutput("slider1Out")
)),
column(4,
wellPanel(
sliderInput("slider2", label = h3("Slider range"), min = 0,
max = 100, value = c(25, 75)),
p("Current Values:"),
verbatimTextOutput("slider2Out")
)),
column(4,
wellPanel(
textInput("text", label = h3("Text input"),
value = "Enter text..."),
p("Current Value:"),
verbatimTextOutput("textOut")
))
)
)
server <- function(input, output) {
output$selectOut <- renderPrint({ input$select})
output$checkboxOut <- renderPrint({ input$checkbox })
output$checkGroupOut <- renderPrint({ input$checkGroup })
output$dateOut <- renderPrint({ input$date })
output$datesOut <- renderPrint({ input$dates })
output$fileOut <- renderPrint({ input$file })
output$numOut <- renderPrint({ input$num })
output$radioOut <- renderPrint({ input$radio })
output$actionOut <- renderPrint({ input$action })
output$slider1Out <- renderPrint({ input$slider1 })
output$slider2Out <- renderPrint({ input$slider2 })
output$textOut <- renderPrint({ input$text })
}
shinyApp(ui = ui, server = server)
# Adapted from https://github.com/rstudio/shiny-examples/tree/master/081-widgets-gallery