Hi. The data below has 4 columns - State, date, number of confirmed cases, and number of recovered cases. I want to calculate the average number of confirmed and recovered cases by week for each state. I have two data issues to deal with:
1. Not all states have the same start date for the confirmed and recovered cases. For example, state X could start on 01/30/2020 and state Y could start on 04/03/2020.
2. There are breaks in the dates. For example, the first entry for state X could be on 01/30/2020 and the next on 02/14/2020.
Calculating this by determining the weekday corresponding to the date doesn't work because of the above issues. Is there anyway to do this? Any guidance would be much appreciated.
1. Not all states have the same start date for the confirmed and recovered cases. For example, state X could start on 01/30/2020 and state Y could start on 04/03/2020.
2. There are breaks in the dates. For example, the first entry for state X could be on 01/30/2020 and the next on 02/14/2020.
Calculating this by determining the weekday corresponding to the date doesn't work because of the above issues. Is there anyway to do this? Any guidance would be much appreciated.
Code:
dataex state numdate confirmed recovered "Andhra Pradesh" 22013 348 6 "Andhra Pradesh" 22014 363 10 "Andhra Pradesh" 22015 381 10 "Andhra Pradesh" 22016 405 10 "Andhra Pradesh" 22017 420 12 "Andhra Pradesh" 22018 439 12 "Andhra Pradesh" 22019 484 16 "Andhra Pradesh" 22020 525 20 "Andhra Pradesh" 22021 534 20 "Andhra Pradesh" 22022 572 35 "Andhra Pradesh" 22023 603 42 "Andhra Pradesh" 22024 647 65 "Andhra Pradesh" 22025 722 92 "Andhra Pradesh" 22026 757 96 "Andhra Pradesh" 22027 813 120 "Andhra Pradesh" 22028 893 141 "Arunachal Pradesh" 22057 1 1 "Arunachal Pradesh" 22058 1 1 "Arunachal Pradesh" 22059 2 1 "Arunachal Pradesh" 22060 2 1 "Arunachal Pradesh" 22061 2 1 "Arunachal Pradesh" 22062 2 1 "Arunachal Pradesh" 22063 3 1 "Arunachal Pradesh" 22064 3 1 "Arunachal Pradesh" 22065 4 1 "Arunachal Pradesh" 22066 4 1 "Arunachal Pradesh" 22067 23 1 "Arunachal Pradesh" 22068 25 1 "Arunachal Pradesh" 22069 34 1 "Arunachal Pradesh" 22070 39 1 "Arunachal Pradesh" 22071 43 1 "Arunachal Pradesh" 22072 45 1 "Arunachal Pradesh" 22073 48 1 "Arunachal Pradesh" 22074 54 1 "Arunachal Pradesh" 22075 54 2 "Arunachal Pradesh" 22076 58 4
Comment