Hi there...
I need to plot the box plot to understand how many days in a month flights are delayed by what time.
1)How can I show time in the graph?
2)How can I improve the graph with better code?
3) Why can't I use the symbol $ during specify x = days_boxplot_df$status , y = days_boxplot_df$daymonth ?
dput(head(days_boxplot_df))
structure(list(flightnumber = c(5935, 6155, 7208, 7215, 7792,
7800), daymonth = c(1, 1, 1, 1, 1, 1), time_difference = structure(c(0,
0, 0, -6, -4, -1), class = "difftime", units = "mins"), status = c("ontime",
"ontime", "ontime", "ontime", "ontime", "ontime")), row.names = c(NA,
6L), class = "data.frame")
class(days_boxplot_df$daymonth)
[1] "numeric"
class(days_boxplot_df$time_difference)
[1] "difftime"class(days_boxplot_df$status)
[1] "character"
box_plot <- ggplot(days_boxplot_df,aes(days_boxplot_df$status,days_boxplot_df$daymonth))
box_plot + geom_boxplot() + labs( x = days_boxplot_df$status , y = days_boxplot_df$daymonth )
Warning messages:
1: Use of days_boxplot_df$status
is discouraged.
Use status
instead.
2: Use of days_boxplot_df$daymonth
is discouraged.
Use daymonth
instead.