R time_trans works with objects of class POSIXct
问题 I have data with stock prices(data). Stock data I would like to visualize it. I first use ggplot R plotting to visualize the series. Date Closed 2010-07-19 0.0808 2010-07-20 0.7547 When I used below code my_date_format <- function() { function(x) { m <- format(x,"%b") y <- format(x,"%Y") ifelse(duplicated(y),m,paste(m,y)) } } ggplot(data, aes(x=Date, z=Closed)) + geom_point() + scale_x_datetime(breaks = date_breaks("1 month"), labels=my_date_format()) I had an error: Error: Invalid input: