Suppose I have a dataset
City Date Cumulative_Visitors-----------------------NY January 1 100NY January 2 150NY January 3 200SF January 1 70SF January 2 200SF January 3 400
I want Matlab to calculate new visitors for each city and date
City Date Cumulative_Visitors New_Visitors---------------------------------------NY January 1 100 100NY January 2 150 50NY January 3 200 50SF January 1 70 70SF January 2 200 130SF January 3 400 200
If I just use diff than the problem is that the first day of each city will be missing or screwed up (take a diff between the last day of NY and the first day of SF)
What can one do about this?
Best Answer