-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
79 lines (52 loc) · 2.11 KB
/
app.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
76
77
78
79
thematic::thematic_shiny()
ui <- fluidPage(
theme=bs_theme(bootswatch = "darkly"
),
# Application title
titlePanel(h1("Fire Environmental Resilience Metrics", align = "center")),
# Sidebar with selectors
fluidRow(
column(width = 2,
selectInput(
inputId = "SEASON",
label = "FIRE SEASON",
choices = seasons),
selectInput(inputId = "DELWP_REGION",
label = "DELWP REGION OR STATE",
choices = c("STATE",
delwpRegions)),
selectInput(inputId = "EFG_NAME",
label = "EFG SELECTION",
choices = c("ALL EFG",
efgNames))
),
column(width = 10,
# Show a plot
plotOutput("tfiPlot",width = "100%",height = 1200)
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
observeEvent(input$DELWP_REGION,{
output$tfiPlot <-renderPlot({
TFI %>%
{if(input$DELWP_REGION!="STATE")
filter(.,DELWP_REGION == input$DELWP_REGION) else (.)
} %>% {
{if(input$EFG_NAME!="ALL EFG")
filter(.,EFG_NAME == input$EFG_NAME) else (.)
}
}
filter(SEASON == input$SEASON) %>%
group_by(EFG_NAME,TFI_STATUS) %>%
summarise(Hectares = sum(Hectares,na.rm = T)) %>%
ggplot(aes(x="",y= Hectares,fill = TFI_STATUS))+
geom_col()+
facet_wrap(facets = ~ EFG_NAME,scales ="free",ncol=4
)
})
})
}
# Run the application
shinyApp(ui = ui, server = server)