R Code Date Breaks
I am getting errors when trying to run date_breaks function through R studio. I have tried running it a couple of ways.
Your environment
- R studio
Steps to reproduce
##Example 1
coord_x_date(xlim = c("2020-07-02", "2020-07-09"), ylim = c(5,30)) +
- scale_x_datetime(date_breaks = "2 hours")
Error: Invalid input: time_trans works with objects of class POSIXct only
###Example 2
coord_x_date(xlim = c("2020-07-02", "2020-07-09"), ylim = c(5,30)) +
- scale_x_date(date_minor_breaks = "2 hours")
Error in cut.Date(date, time, right = TRUE, include.lowest = TRUE) :
invalid specification of 'breaks'
###Example 3
coord_x_date(xlim = c("2020-07-02", "2020-07-09"), ylim = c(5,30)) +
+
- scale_x_datetime(breaks = date_breaks("1 day"), minor_breaks = date_breaks("2 hour"))
Error: Invalid input: time_trans works with objects of class POSIXct only
##Any idea what I might be doing wrong?