Search code examples
rggplot2chron

Is scale_x_chron broken in ggplot2 2.2.1 and R 3.5.0?


If I run the example in ?scale_x_chron:

if(require("ggplot2")) {
dd <- data.frame(tt = chron(1:10), value = 101:110)
p <- ggplot(dd, aes(tt, value)) +
         geom_point() + scale_x_chron(format = "%m-%d")
print(p)
}

I get

Error in as.POSIXct.default(x) : 
do not know how to convert 'x' to class “POSIXct” 

Is the function broken? Should I install another version? I tried to update via rstudio update button (in packages) but no luck.

EDIT: chron version is chron_2.3-45

EDIT2: I have noticed that

as.Date(chronDate)
Error in as.Date.default(chronDate) : 
do not know how to convert 'chronDate' to class “Date”

It used to work back in R 3.4... I am having trouble to go back to previous versions of R, so this is really a problem for me..


Solution

  • The problem is solved now. Updating chron to chron_2.3-52 solved everything.