generated from jtr13/bookdown-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsolution-server.R
49 lines (41 loc) · 1.32 KB
/
solution-server.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
library(shiny)
ui <- fluidPage(
titlePanel("Challenge 2"),
sidebarLayout(
sidebarPanel(
selectInput("dataset", label = "Dataset", choices = ls("package:datasets"), selected = "airquality"),
helpText("List of variables to choose from"),
selectInput("var",
label = "Choose a region to display",
choices = list("Ozone",
"Solar.R",
"Wind",
"Temp",
"Month",
"Day"),
selected = "Wind"),
sliderInput("range",
label = "Range of wind speed:",
min = 0, max = 30, value = c(5, 21))
),
mainPanel(
textOutput("name") ,
textOutput("outvar"),
textOutput("outrange")
)
)
)
# Server logic ----
server <- function(input, output) {
output$name <- renderText({
paste0("The dataset selected is ",input$dataset)
})
output$outvar <- renderText({
paste0("The variable selected is ", input$var)
})
output$outrange <- renderText({
paste0("The range selected is ", input$range[1], ":", input$range[2]) # or just renderPrint({ input$range })
})
}
# Run the app ----
shinyApp(ui = ui, server = server)