0

I want to plot multiple lines to one graph of five different time series. The problem is that my data frame is arranged like so:

Series  Time        Price    ...
1       Dec 2003    5
2       Dec 2003    10
3       Dec 2003    2
1       Jan 2004    10
2       Jan 2004    10
3       Jan 2004    5

This is a simplified version, and there are many other variables for each observation. I'd like to be able to plot time vs price and use the first variable as the indicator for which series.

The time period is 77 months long, so I'm not sure if there's an easy way to reshape the data to look like:

Series  Dec.2003.Price  Jan.2004.Price   ...
1       5               10
2       10              10
3       2               5

or a way to graph these like I said without reshaping.

Jocelyn
  • 1
  • 2
  • Maybe this will help? http://stackoverflow.com/questions/10349096/group-data-and-plot-multiple-lines – Liesel Feb 09 '16 at 05:05

1 Answers1

0

You can try

xyplot(Price ~ Time, groups=Series, data=df, type="l")
Carlos Alberto
  • 598
  • 3
  • 9