diff --git a/proj3/projekt.R b/proj3/projekt.R index 806109f..6a6cade 100644 --- a/proj3/projekt.R +++ b/proj3/projekt.R @@ -63,25 +63,42 @@ airplane_crashes$btwn_6PM_6AM <- if_else ui <- fluidPage( id = "main_content", 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", - 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"), - plotlyOutput("hourCrashes"), - plotlyOutput("monthCrashes") - ) - ) - ), + fixedRow( + column(3, + dateRangeInput('dates', + 'Date range:', + min(airplane_crashes$Date), + max(airplane_crashes$Date)), + # wybor godziny + timeInput("time", "Time (local):", seconds = FALSE)), + column(6, plotlyOutput("weekdayCrashes")) + ), + fixedRow( + column(3, plotlyOutput("hourCrashes")), + column(3, plotlyOutput("monthCrashes")) + )), tabPanel("Streamgraph", mainPanel( streamgraphOutput("operatorCrashes") @@ -100,10 +117,12 @@ ui <- fluidPage( dateRangeInput('dataDates', 'Date range:', min(airplane_crashes$Date), - max(airplane_crashes$Date)) + max(airplane_crashes$Date)), + downloadButton('downloadData', 'Download') ), mainPanel( DT::dataTableOutput('allData') + )) ) ) @@ -323,8 +342,16 @@ server <- function(input, output, session) { originalData = TRUE ) }) - - # 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({ airplane_crashes %>% # filter(Year == input$dataDates) %>%