added save_csv button

This commit is contained in:
patrycjalazna 2021-06-23 16:45:41 +02:00
parent e9dfdbd67b
commit 6d891c2d02

View File

@ -63,25 +63,42 @@ airplane_crashes$btwn_6PM_6AM <- if_else
ui <- fluidPage( ui <- fluidPage(
id = "main_content", id = "main_content",
navbarPage("Airplane crashes from 1908 to 2020", navbarPage("Airplane crashes from 1908 to 2020",
# tabPanel("General overview",
# sidebarLayout(
# sidebarPanel(
# # wybór daty
# dateRangeInput('dates',
# 'Date range:',
# min(airplane_crashes$Date),
# max(airplane_crashes$Date)),
# # wybor godziny
# timeInput("time", "Time (local):", seconds = FALSE)
# ),
# mainPanel(
# # wykresiki
# plotlyOutput("weekdayCrashes"),
# fixedRow(
# column(3, plotlyOutput("hourCrashes")),
# column(3, plotlyOutput("monthCrashes"))
# )
# )
# )
# ),
tabPanel("General overview", tabPanel("General overview",
sidebarLayout( fixedRow(
sidebarPanel( column(3,
# wybór daty
dateRangeInput('dates', dateRangeInput('dates',
'Date range:', 'Date range:',
min(airplane_crashes$Date), min(airplane_crashes$Date),
max(airplane_crashes$Date)), max(airplane_crashes$Date)),
# wybor godziny # wybor godziny
timeInput("time", "Time (local):", seconds = FALSE) timeInput("time", "Time (local):", seconds = FALSE)),
), column(6, plotlyOutput("weekdayCrashes"))
mainPanel(
# wykresiki
plotlyOutput("weekdayCrashes"),
plotlyOutput("hourCrashes"),
plotlyOutput("monthCrashes")
)
)
), ),
fixedRow(
column(3, plotlyOutput("hourCrashes")),
column(3, plotlyOutput("monthCrashes"))
)),
tabPanel("Streamgraph", tabPanel("Streamgraph",
mainPanel( mainPanel(
streamgraphOutput("operatorCrashes") streamgraphOutput("operatorCrashes")
@ -100,10 +117,12 @@ ui <- fluidPage(
dateRangeInput('dataDates', dateRangeInput('dataDates',
'Date range:', 'Date range:',
min(airplane_crashes$Date), min(airplane_crashes$Date),
max(airplane_crashes$Date)) max(airplane_crashes$Date)),
downloadButton('downloadData', 'Download')
), ),
mainPanel( mainPanel(
DT::dataTableOutput('allData') DT::dataTableOutput('allData')
)) ))
) )
) )
@ -324,7 +343,15 @@ server <- function(input, output, session) {
) )
}) })
# poprawic szerkosc wierszy output$downloadData <- downloadHandler(
filename = function() {
paste('airplane_crashes', '.csv', sep='')
},
content = function(file) {
write.csv(airplane_crashes, file)
}
)
output$allData <- DT::renderDataTable({ output$allData <- DT::renderDataTable({
airplane_crashes %>% airplane_crashes %>%
# filter(Year == input$dataDates) %>% # filter(Year == input$dataDates) %>%