简体   繁体   中英

How to plot multiple time series data in R

I am totally new in R.. and i need to plot time series data like this:

Month Revenue 20110101 12000 20110102 11000 20110103 10700 ................
20170111 10400 20170112 10000

I load data from .csv and Date is stored as a number. and i try this code:

plot(R$Month,R$revenue,type = 'l')

在此处输入图片说明

Any idea how i can convert numbers on X as Dates and make better plot. Because this is not correct.

Thank you in advance!

Just convert to Date.

R$Month <- as.Date(R$Month, format = "%Y%m%d")

plot(R$Month,R$revenue,type = 'l')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM