Title: | Pulling Clean Data from Covid19india.org |
---|---|
Description: | Pull raw and pre-cleaned versions of national and state-level COVID-19 time-series data from covid19india.org <https://www.covid19india.org>. Easily obtain and merge case count data, testing data, and vaccine data. Also assists in calculating the time-varying effective reproduction number with sensible parameters for COVID-19. |
Authors: | Max Salvatore [aut, cre], Michael Kleinsasser [aut] |
Maintainer: | Max Salvatore <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.5 |
Built: | 2025-03-08 03:00:52 UTC |
Source: | https://github.com/maxsal/covid19india |
Check for data corrections of X-times magnitude - data.table style
check_for_data_correction( dat, var, magnitude = 10, min_count = 10, fill_locf = TRUE )
check_for_data_correction( dat, var, magnitude = 10, min_count = 10, fill_locf = TRUE )
dat |
data set |
var |
variable for which to check for corrections. Default is |
magnitude |
magnitude of difference that qualifies as a data correction. Default is |
min_count |
minimum count of var. Default is |
Data set with data correction observations removed
## Not run: check_for_data_correction(dat = get_nat_counts, var = "daily_cases", magnitude = 10) ## End(Not run)
## Not run: check_for_data_correction(dat = get_nat_counts, var = "daily_cases", magnitude = 10) ## End(Not run)
Helper function
extract_latest(dat, group = place, clmns = c("total_tests", "tpr", "ppt"))
extract_latest(dat, group = place, clmns = c("total_tests", "tpr", "ppt"))
dat |
data set |
group |
place variable |
clmns |
columns to be extracted |
Data set of recent observations of selected variables
## Not run: extract_latest(dat = get_all_data()) ## End(Not run)
## Not run: extract_latest(dat = get_all_data()) ## End(Not run)
Pull all covid19india count, test, and vaccine data for states and nation
get_all_data( keep_nat = TRUE, covind19_name_scheme = FALSE, corr_check = TRUE, mohfw = TRUE, inc_days = 3 )
get_all_data( keep_nat = TRUE, covind19_name_scheme = FALSE, corr_check = TRUE, mohfw = TRUE, inc_days = 3 )
keep_nat |
Keep the national data as well. Default is |
covind19_name_scheme |
Variable naming scheme used for development of |
corr_check |
Check for data corrections of X-times magnitude. Default is |
mohfw |
mohfw switch to mohfw. Defauly is |
inc_days |
Number of days from infection to symptoms |
Pulls the district-level time-series case, death, and recovered data directly from covid19india.org
.
## Not run: get_all_data() ## End(Not run)
## Not run: get_all_data() ## End(Not run)
Calculate case_fataility rate
get_cfr(x)
get_cfr(x)
x |
Input dataset. Expects |
Calculates a case-fatality rate estimate and corresponding 95% confidence interval
## Not run: get_cfr(x = get_nat_counts()) ## End(Not run)
## Not run: get_cfr(x = get_nat_counts()) ## End(Not run)
Pull covid19india district-level data
get_district_counts( path = "https://api.covid19india.org/csv/latest/districts.csv", raw = FALSE )
get_district_counts( path = "https://api.covid19india.org/csv/latest/districts.csv", raw = FALSE )
path |
The URL path for the data. Default: |
raw |
Pull raw unaltered data. Default is |
Pulls the district-level time-series case, death, and recovered data directly from covid19india.org.
## Not run: get_district_counts() ## End(Not run)
## Not run: get_district_counts() ## End(Not run)
Create metrics tables
get_metrics_tables( seed = 46342, top20 = NULL, corr_check = FALSE, inc_days = 3 )
get_metrics_tables( seed = 46342, top20 = NULL, corr_check = FALSE, inc_days = 3 )
seed |
set seed |
top20 |
Vector of state abbreviations for top 20 table |
corr_check |
Check for data corrections of X-times magnitude. Default is |
inc_days |
Number of days from infection to symptoms |
Creates metrics tables for use in covind19.org
## Not run: tabs <- get_metrics_tables() tabs$full ## End(Not run)
## Not run: tabs <- get_metrics_tables() tabs$full ## End(Not run)
Pull covid19india national time series data
get_nat_counts( path = "https://api.covid19india.org/csv/latest/case_time_series.csv", raw = FALSE, corr_check = TRUE, mohfw = TRUE )
get_nat_counts( path = "https://api.covid19india.org/csv/latest/case_time_series.csv", raw = FALSE, corr_check = TRUE, mohfw = TRUE )
path |
The URL path for the data. Default: https://api.covid19india.org/csv/latest/case_time_series.csv |
raw |
Pull raw unaltered data. Default is |
corr_check |
Check for data correction. Default is |
mohfw |
switch to mohfw default is |
Pulls the time-series case, death, and recovered data directly from covid19india.org.
## Not run: get_nat_counts_dt() ## End(Not run)
## Not run: get_nat_counts_dt() ## End(Not run)
Pull covid19india national time series test data
get_nat_tests( path = "https://data.covid19india.org/csv/latest/tested_numbers_icmr_data.csv", raw = FALSE )
get_nat_tests( path = "https://data.covid19india.org/csv/latest/tested_numbers_icmr_data.csv", raw = FALSE )
path |
The URL path for the data. Default: |
raw |
Pull raw unaltered data. Default is |
Pulls the time-series test data directly from covid19india.org.
## Not run: get_nat_tests() ## End(Not run)
## Not run: get_nat_tests() ## End(Not run)
Helper function for pulling latest R estimates
get_r_est(x)
get_r_est(x)
x |
data set containing R estimates |
Pulls 7-day trailing average R estimates and 95% confidence intervals
## Not run: get_r_est(x = get_all_data()) ## End(Not run)
## Not run: get_r_est(x = get_all_data()) ## End(Not run)
Calculate r0
get_r0( dat, daily_filter = 0, total_filter = 50, min_date = "2020-03-23", corr_check = FALSE, inc_days = 3 )
get_r0( dat, daily_filter = 0, total_filter = 50, min_date = "2020-03-23", corr_check = FALSE, inc_days = 3 )
dat |
Input dataset. Expects |
daily_filter |
Threshold for minimum daily cases. Default = |
total_filter |
Threshold for minimum total cases reported to date. Default = |
min_date |
Threshold for earliest date to report R_0. Default = |
corr_check |
Check for data corrections of X-times magnitude. Default is |
inc_days |
Number of days from infection to symptoms |
Pulls the time-series state-level testing data directly from covid19india.org. Expects columns named place
, daily_cases
, and total_cases
. Can specify corresponding variables through other arguments.
## Not run: get_r0(dat = get_nat_counts()) ## End(Not run)
## Not run: get_r0(dat = get_nat_counts()) ## End(Not run)
Pull covid19india state
get_state_counts( path = "https://api.covid19india.org/csv/latest/state_wise_daily.csv", raw = FALSE, keep_nat = FALSE, corr_check = FALSE, mohfw = TRUE )
get_state_counts( path = "https://api.covid19india.org/csv/latest/state_wise_daily.csv", raw = FALSE, keep_nat = FALSE, corr_check = FALSE, mohfw = TRUE )
path |
The URL path for the data. Default: |
raw |
Pull raw unaltered data. Default is |
keep_nat |
Keep the national data as well. Default is |
corr_check |
Check for data correction. Default is |
mohfw |
switch to mohfw default is |
Pulls the time-series case, death, and recovered data directly from covid19india.org.
## Not run: get_state_counts() ## End(Not run)
## Not run: get_state_counts() ## End(Not run)
Pull covid19india state-level testing data
get_state_tests( path = "https://api.covid19india.org/csv/latest/statewise_tested_numbers_data.csv", raw = FALSE )
get_state_tests( path = "https://api.covid19india.org/csv/latest/statewise_tested_numbers_data.csv", raw = FALSE )
path |
The URL path for the data. Default: https://api.covid19india.org/csv/latest/statewise_tested_numbers_data.csv |
raw |
Pull raw unaltered data. Default is FALSE |
Pulls the time-series state-level testing data directly from covid19india.org.
## Not run: get_state_tests() ## End(Not run)
## Not run: get_state_tests() ## End(Not run)
Pull covid19india state-level vaccine data
get_state_vax( path = "https://api.covid19india.org/csv/latest/vaccine_doses_statewise_v2.csv", raw = FALSE, keep_nat = TRUE, mohfw = TRUE )
get_state_vax( path = "https://api.covid19india.org/csv/latest/vaccine_doses_statewise_v2.csv", raw = FALSE, keep_nat = TRUE, mohfw = TRUE )
path |
The URL path for the data. Default: https://api.covid19india.org/csv/latest/vaccine_doses_statewise_v2.csv |
raw |
Pull raw unaltered data. Default is FALSE |
keep_nat |
Keep national level data? Default is TRUE |
mohfw |
switch to mohfw. default is |
Pulls the time-series state-level vaccine data directly from covid19india.org.
## Not run: get_state_vax() ## End(Not run)
## Not run: get_state_vax() ## End(Not run)
This data set contains the names of states and union territories in India along with their respective abbreviations and populations. The population of India is also given. These are 2019 projections as reported in the Unique Identification Authority of India 2019-2020 Annual Report.
pop
pop
A data frame with 39 rows and 3 variables: place
, abbrev
,
population
The name of the place
The abbreviations corresponding to place
The population size
2019-2020 Annual Report Annexure IV (pg 103), Unique Identification Authority of India https://uidai.gov.in/images/AADHAR_AR_2019_20_ENG_approved.pdf