This is first time I am trying to work with time-series plots. I have a dataset with approximately 50k rows with similar structure as below for multiple years;
Year expense_1 expense_2 expense_3 expense_4
1999 5 NA NA 31.82
2000 2 NA NA 4.75
1999 10.49 NA NA NA
2000 39.69 NA NA NA
2000 NA NA 10.61 NA
1999 8.08 NA NA NA
2000 16 NA NA NA
1999 9.32 NA NA NA
1999 9.35 NA NA NA
Now, I want to plot a time-series with Year
on the X-axis, Expense
on the Y-axis with different lines each for expense_1
, expense_2
, expense_3
, expense_4
. The expense for each category should be summed-up year-wise and NA
should be removed.