-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.R
45 lines (35 loc) · 910 Bytes
/
app.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
library(shiny)
library(ggplot2)
ui <- fluidPage(
# *Input() functions
fluidRow(
column(width = 4, offset = 4,
sliderInput(inputId = "num", label = "Choose a number", min = 0, max = 100, value = 25)
)
),
# *Output() functions
fluidRow(
column(width = 6,
plotOutput("hist")
),
column(width = 6,
plotOutput("qq")
)
)
# layout functions
)
server <- function(input, output) {
# reactive() components
data <- reactive({rnorm(input$num)})
# render*() functions (save results to ouput$)
output$hist <- renderPlot({
qplot(data(), geom = "histogram", xlab = "sample")
# hist(rnorm(input$num))
})
output$qq <- renderPlot({
qplot(sample = data(), stat = "qq")
# qqnorm(rnorm(input$num))
})
# observeEvent(), reactive(), eventReactive() functions
}
shinyApp(server = server, ui = ui)