0

I have quarterly data on the prices of 4 types of petroleum prices and trying to do some analysis on it.

I am trying to get my tsibble from this:

date ts1 ts2 ts3

to a tsibble of this format:

enter image description here

Essentially, I am trying to condense the 4 time series data by specifying a new key called "fuel_type" in my new tsibble.

The reason why, is because once I get it into the latter tsibble format, the autoplot() function makes my life easier for plotting all 4 time series graphs in one go.

Thanks!

  • You should not add data as image. Read about [how to give a reproducible example](http://stackoverflow.com/questions/5963269). Have you tried solutions from this post https://stackoverflow.com/questions/2185252/reshaping-data-frame-from-wide-to-long-format ? – Ronak Shah Aug 26 '21 at 13:46
  • THANK YOU SO MUCH RONAK this is exactly what I needed, you are a legend :) – BrendonKoum Aug 26 '21 at 14:25

0 Answers0