fixed weekday col names

This commit is contained in:
patrycjalazna 2021-06-22 20:00:43 +02:00
parent cd5275b075
commit 998979918f

View File

@ -1,5 +1,4 @@
# setup srodowiska ####
setwd('/Users/patrycjalazna/Desktop/wizualizacja-danych/projekt_3/')
install.packages('shinyjs')
# importy ####
@ -120,12 +119,22 @@ server <- function(input, output, session) {
observe(print(strftime(input$time, "%R")))
output$weekdayCrashes <- renderPlotly({
week_day <- airplane_crashes %>% count(Weekday)
week_day$Weekday[week_day$Weekday == "1"] <- "Monday"
# c('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')
week_day$Weekday <- as.character(week_day$Weekday)
week_day$Weekday[week_day$Weekday == 1] <- "Monday"
week_day$Weekday[week_day$Weekday == 2] <- "Tuesday"
week_day$Weekday[week_day$Weekday == 3] <- "Wednesday"
week_day$Weekday[week_day$Weekday == 4] <- "Thursday"
week_day$Weekday[week_day$Weekday == 5] <- "Friday"
week_day$Weekday[week_day$Weekday == 6] <- "Saturday"
week_day$Weekday[week_day$Weekday == 7] <- "Sunday"
# zmiana kolejnosci dni; dni nie powinny sie wyswietlac alfabetycznie
week_day$Weekday <- factor(week_day$Weekday, levels= c('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'))
plot_ly(
x = week_day$Weekday, y = week_day$n,
name = 'Week Day Crashes', type = "bar"