I tried to convert the month variable (which is an integer) into a categorical variable using factor(month), but I failed because of the error. How could I solve it?
This is my code:
library(tidyverse)
library(dplyr)
install.packages("nycflights13")
library(nycflights13)
month_new <- flights$month
month_new
flights %>%
filter(dest == "HNL", air_time > 10) %>%
factor(month_new) %>%
ggplot(x = month_new) + geom_bar()