Context, I am looking to melt a wide time-series data frame into a long data frame. This way I can plot the data in ggplot2 and build a stacked area graph. The time series is not regular (missing some weekends and holidays)
The current data frame looks like
df
date item_1 item_2 item_3 ...
1 1992-03-23 8.63 7.609 1.6546 ...
2 1992-03-24 7.98 7.634 1.6533 ...
...
How do I convert the above data frame into
date variable value
1 1992-03-23 item_1 8.63
2 1992-03-23 item_2 7.609
3 1992-03-23 item_3 1.6546
2 1992-03-24 item_1 7.98
using the following code I get the error
> melted_df = melt(df)
Using as id variables
Error in as.Date.numer(value): 'origin' must be supplied