I have a R dataframe like this:
Year | Country | Car | Bike | Truck |
---|---|---|---|---|
2010 | US | 4342 | 5783 | 5849 |
2011 | US | 8292 | 4304 | 4839 |
2012 | US | 5839 | 5930 | 8483 |
I need to plot a spaghetti plot for all three types(car,bike,truck) for US. That is: Type as the legend. I understand that I need to interchange columns of Types to rows. But I am unable to do that with out interchanging Year.
In a nutshell, I think I need this kind of table to plot the spaghetti plot.
Year | Type | Country |
---|---|---|
2010 | US | XXXX |
2010 | US | XXXX |
2010 | US | XXXX |
2011 | US | XXXX |
2011 | US | XXXX |
2011 | US | XXXX |
2012 | US | XXXX |
2012 | US | XXXX |
2012 | US | XXXX |
Please help!