-
Notifications
You must be signed in to change notification settings - Fork 0
/
random-shinyApp.R
64 lines (49 loc) · 1.1 KB
/
random-shinyApp.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
library(shiny)
ui <- fluidPage(
titlePanel("Histogram of Random Normal Values"),
wellPanel(
sliderInput(
inputId = "num",
label = "Choose a number:",
min = 1,
max = 100,
value = 50
),
textInput(
inputId = "text",
label = "Change title?",
value = "Histogram of Random Normal Values"
),
"Histogram only works with this buttons: ",
actionButton(inputId = "norm",
label = "Normal"),
actionButton(inputId = "unif",
label = "Uniform")),
column(8, plotOutput("hist")),
verbatimTextOutput("stats")
)
server <- function (input, output) {
data <-
rv <- reactiveValues(data = rnorm(100))
eventReactive(input$clicks, {
rnorm(input$num)
})
reactive ({
rnorm(input$num)
})
output$hist <- renderPlot({
hist(rv$data,
main = isolate({input$text})
)
})
output$stats <- renderPrint({
summary(rnorm(input$num))
})
observeEvent(input$norm, {
rv$data <-rnorm(100)
})
observeEvent(input$unif, {
rv$data <-runif(100)
})
}
shinyApp(ui = ui, server = server)