Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206278

Monthly Time series data in ggplot2

$
0
0

I want to plot monthly time series with data below and I am getting the Error:

Invalid input: date_trans works with objects of class Date only* 

Any help will be much appreciated.

below is my code:

theme_set(theme_bw())
rdata1_m <- rdata1[1:36, ]
lbls <-paste0(month.abb[month(rdata1_m$date)], "",lubridate::year(rdata1_m$date))
brks <- rdata1_m$date 
ggplot(rdata1_m, aes(x=date)) +geom_line(aes(y=GoldPrice)) +
scale_x_date(labels = lbls,breaks = brks) +
theme(axis.text.x = element_text(angle = 90, vjust=0.5),
panel.grid.minor = element_blank())

and my data is: enter image description here


Viewing all articles
Browse latest Browse all 206278

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>