-
Notifications
You must be signed in to change notification settings - Fork 370
/
server.R
43 lines (31 loc) · 1.02 KB
/
server.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
# This is the server logic for a Shiny web application.
# You can find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com
#
library(shiny)
library(choroplethr)
library(choroplethrMaps)
shinyServer(function(input, output) {
output$map <- renderPlot({
data('df_state_demographics')
df_state_demographics$value = df_state_demographics[, input$select]
state_choropleth(df_state_demographics,
title = input$select,
num_colors = input$num_colors)
})
output$table <- renderDataTable({
data("df_state_demographics")
df_state_demographics[, c('region', input$select)]
})
output$downloadData <- downloadHandler(
filename = function() {
paste('data-', Sys.Date(), '.csv', sep='')
},
content = function(con) {
data("df_state_demographics")
data = df_state_demographics[, c('region', input$select)]
write.csv(data, con)
}
)
})