-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserCount.R
More file actions
30 lines (22 loc) · 749 Bytes
/
Copy pathuserCount.R
File metadata and controls
30 lines (22 loc) · 749 Bytes
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
# See: https://gist.github.com/trestletech/9926129
if (!require(shiny))
install.packages(shiny)
# For Current User Count:
vals <- reactiveValues(count=0)
server <- function(input,output,session){
# when a session begins, add 1 to count
isolate(vals$count <- vals$count + 1)
# when a session ends, subtract 1 from count
session$onSessionEnded(function(){
isolate(vals$count <- vals$count - 1)
})
# Put count in an output object to display in ui.R
output$count <- renderText({
vals$count
})
}
ui <- navbarPage("How Many People Are Using the App?"
# Show How Many People are Using the App
,header = div(p("There are currently ",textOutput("count",inline=TRUE)," app users."))
)
shinyApp(server=server,ui=ui)