-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.R
75 lines (55 loc) · 2 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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(plotly)
source("RestaurantDataPrep.R")
shinyServer(function(input, output) {
reactdata <- reactive({
subset(fullresult, fullresult$State == input$states)
})
trans_factor <- reactive({
socio_lookup[input$factor, ]
})
output$povPlot <- renderPlotly({
d <- reactdata()[,c("FSRPTH07", "POVRATE10","MEDHHINC10","State", "County")]
f <- list(
family = "Tahoma",
size = 8,
color = "#7f7f7f"
)
x <- list(
title = "Fast Food per 1000 Residents",
titlefont = f
)
y <- list(
title = "County Poverty Rate Income",
titlefont = f
)
plot_ly(d,x= ~FSRPTH07, y = ~POVRATE10, name="Fast Food Restaurants per 1000 Residents and County Poverty Rate" , mode="markers", type="scatter", color=~ State, text = ~paste("County: ", County),
marker=list(size=15, width=8)
) %>%
layout(xaxis = x, yaxis = y, title="Fast Food Restaurants per 1000 Residents and County Poverty Rate", font=list(size=12, color="navy"))
})
output$incPlot <- renderPlotly({
f <- list(
family = "Tahoma",
size = 8,
color = "#7f7f7f"
)
x <- list(
title = "Fast Food per 1000 Residents",
titlefont = f
)
y <- list(
title = "County Median Household Income",
titlefont = f
)
d <- reactdata()[,c("FSRPTH07", "POVRATE10","MEDHHINC10","State", "County")]
plot_ly(d,x= ~FSRPTH07, y = ~MEDHHINC10, name= "Fast Food Restaurants per 1000 Residents and County Median income Rate", mode="markers", type="scatter", color=~ State, text = ~paste("County: ", County),
marker=list(size=15, width=8)) %>%
layout(xaxis = x, yaxis = y, title="Fast Food Restaurants per 1000 Residents and County Median income Rate", font=list(size=12, color="navy"))
})
})