-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclicktest.R
57 lines (39 loc) · 1.16 KB
/
clicktest.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
ui <- fluidPage(
# App title ----
titlePanel("Hello Shiny!"),
# Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
actionButton("clickBtn", "Click")
),
mainPanel(
# conditionalPanel(
# condition = 'output.clickCount == "0"',
# print(1)
# ),
#
# conditionalPanel(
# condition = 'output.clickCount != "0"',
# print(2)
# )
# print(counter$countervalue),
textOutput("count"),
conditionalPanel(
condition = 'input.clickBtn == "0"',
print('시작을 눌러주세요')
)
)
)
)
counter = 0
server = function(input, output, session) {
counter <- reactiveValues(countervalue = 0)
observeEvent(input$clickBtn, {
counter$countervalue <- counter$countervalue + 1 # if the add button is clicked, increment the value by 1 and update it
})
output$count <- renderText({
counter$countervalue # print the latest value stored in the reactiveValues object
})
}
shinyApp(ui = ui, server = server)