-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathex5.R
57 lines (46 loc) · 1.31 KB
/
ex5.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
library(shiny)
library(magrittr)
library(purrr)
zoom = FALSE
pigs_generator <- function(howmany){
tagList(1:howmany %>% map(function(x) icon("piggy-bank", lib = "glyphicon")))
}
ui <- fluidPage(
titlePanel("Hello Cardiff"),
sidebarLayout(
sidebarPanel(
uiOutput("sidebarui"),
actionButton("go_button", "Go!"),
textInput("name", "Give your name here"),
selectInput("column", "Select column to plot", colnames(mtcars))
),
mainPanel(
div(style = "background: grey; color: white;",
tags$p("Here is where the action takes place")
),
tags$h3(textOutput("welcome_message")),
#TODO (part 1) place for plotOutput
#TODO (part 2) TODO place for uiOutput "pigs"
tags$img(src="https://media.giphy.com/media/u47skfNmdGSM05XP5G/giphy.gif", width="200px")
)
)
)
server <- function(input, output) {
if (isTRUE(zoom))
output$sidebarui <- renderUI({
tags$h2("This is sidebar")
})
else
output$sidebarui <- renderUI({
tags$h4("This is sidebar")
})
observeEvent(input$go_button, {
print("Go")
#TODO (part 2) add code for rendering pigs
})
output$welcome_message <- renderText({
paste("Welcome", input$name)
})
#TODO (part 1) place for renderPlot
}
shinyApp(ui = ui, server = server)