Type: | Package |
Title: | Pulling Clean Data from Covid19india.org |
Version: | 0.1.4 |
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. |
URL: | https://github.com/maxsal/covid19india |
BugReports: | https://github.com/maxsal/covid19india/issues |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.2 |
Imports: | data.table (≥ 1.14.1), EpiEstim, cli, gt, httr, glue, janitor, scales, stringr, magrittr |
Depends: | R (≥ 3.6) |
NeedsCompilation: | no |
Packaged: | 2021-10-08 15:09:45 UTC; maxsalvatore |
Author: | Max Salvatore [aut, cre], Michael Kleinsasser [aut] |
Maintainer: | Max Salvatore <mmsalva@umich.edu> |
Repository: | CRAN |
Date/Publication: | 2021-10-09 15:00:30 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs)
.
Helper function for calculating case-fatality rate
Description
Helper function for calculating case-fatality rate
Usage
CFR(C, D)
Arguments
C |
Cases vector |
D |
Deaths vector |
Value
A case-fatality rate estimate and 95% confidence limits
Examples
## Not run:
national_data <- get_nat_counts()
CFR(C = national_data$total_cases, D = national_data$total_deaths)
## End(Not run)
Check for data corrections of X-times magnitude - data.table style
Description
Check for data corrections of X-times magnitude - data.table style
Usage
check_for_data_correction(
dat,
var = "daily_cases",
magnitude = 10,
min_count = 10
)
Arguments
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 |
Value
Data set with data correction observations removed
Examples
## Not run:
check_for_data_correction(dat = get_nat_counts, var = "daily_cases", magnitude = 10)
## End(Not run)
Helper function for calculating R_0 - data.table style
Description
Helper function for calculating R_0 - data.table style
Usage
estR0_out(x)
Arguments
x |
Input dataset |
Value
Pulls the time-series state-level testing data directly from covid19india.org.
Examples
## Not run:
estR0_out_dt(x = get_nat_counts())
## End(Not run)
Helper function
Description
Helper function
Usage
extract_latest(dat, group = place, clmns = c("total_tests", "tpr", "ppt"))
Arguments
dat |
data set |
group |
place variable |
clmns |
columns to be extracted |
Value
Data set of recent observations of selected variables
Examples
## Not run:
extract_latest(dat = get_all_data())
## End(Not run)
Pull all covid19india count, test, and vaccine data for states and nation
Description
Pull all covid19india count, test, and vaccine data for states and nation
Usage
get_all_data(keep_nat = TRUE, covind19_name_scheme = FALSE, corr_check = TRUE)
Arguments
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 |
Value
Pulls the district-level time-series case, death, and recovered data directly from covid19india.org
.
Examples
## Not run:
get_all_data()
## End(Not run)
Calculate case_fataility rate
Description
Calculate case_fataility rate
Usage
get_cfr(x)
Arguments
x |
Input dataset. Expects |
Value
Calculates a case-fatality rate estimate and corresponding 95% confidence interval
Examples
## Not run:
get_cfr(x = get_nat_counts())
## End(Not run)
Pull covid19india district-level data
Description
Pull covid19india district-level data
Usage
get_district_counts(
path = "https://api.covid19india.org/csv/latest/districts.csv",
raw = FALSE
)
Arguments
path |
The URL path for the data. Default: |
raw |
Pull raw unaltered data. Default is |
Value
Pulls the district-level time-series case, death, and recovered data directly from covid19india.org.
Examples
## Not run:
get_district_counts()
## End(Not run)
Create metrics tables
Description
Create metrics tables
Usage
get_metrics_tables(seed = 46342, top20 = NULL, corr_check = TRUE)
Arguments
seed |
set seed |
top20 |
Vector of state abbreviations for top 20 table |
corr_check |
Check for data corrections of X-times magnitude. Default is |
Value
Creates metrics tables for use in covind19.org
Examples
## Not run:
tabs <- get_metrics_tables()
tabs$full
## End(Not run)
Pull covid19india national time series data
Description
Pull covid19india national time series data
Usage
get_nat_counts(
path = "https://api.covid19india.org/csv/latest/case_time_series.csv",
raw = FALSE,
corr_check = FALSE
)
Arguments
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 |
Value
Pulls the time-series case, death, and recovered data directly from covid19india.org.
Examples
## Not run:
get_nat_counts_dt()
## End(Not run)
Pull covid19india national time series test data
Description
Pull covid19india national time series test data
Usage
get_nat_tests(
path = "https://data.covid19india.org/csv/latest/tested_numbers_icmr_data.csv",
raw = FALSE
)
Arguments
path |
The URL path for the data. Default: |
raw |
Pull raw unaltered data. Default is |
Value
Pulls the time-series test data directly from covid19india.org.
Examples
## Not run:
get_nat_tests()
## End(Not run)
Calculate r0
Description
Calculate r0
Usage
get_r0(
dat,
daily_filter = 0,
total_filter = 50,
min_date = "2020-03-23",
corr_check = FALSE
)
Arguments
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 |
Value
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.
Examples
## Not run:
get_r0(dat = get_nat_counts())
## End(Not run)
Helper function for pulling latest R estimates
Description
Helper function for pulling latest R estimates
Usage
get_r_est(x)
Arguments
x |
data set containing R estimates |
Value
Pulls 7-day trailing average R estimates and 95% confidence intervals
Examples
## Not run:
get_r_est(x = get_all_data())
## End(Not run)
Pull covid19india state
Description
Pull covid19india state
Usage
get_state_counts(
path = "https://api.covid19india.org/csv/latest/state_wise_daily.csv",
raw = FALSE,
keep_nat = FALSE,
corr_check = FALSE
)
Arguments
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 |
Value
Pulls the time-series case, death, and recovered data directly from covid19india.org.
Examples
## Not run:
get_state_counts()
## End(Not run)
Pull covid19india state-level testing data
Description
Pull covid19india state-level testing data
Usage
get_state_tests(
path = "https://api.covid19india.org/csv/latest/statewise_tested_numbers_data.csv",
raw = FALSE
)
Arguments
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 |
Value
Pulls the time-series state-level testing data directly from covid19india.org.
Examples
## Not run:
get_state_tests()
## End(Not run)
Pull covid19india state-level vaccine data
Description
Pull covid19india state-level vaccine data
Usage
get_state_vax(
path = "https://api.covid19india.org/csv/latest/vaccine_doses_statewise_v2.csv",
raw = FALSE,
keep_nat = TRUE
)
Arguments
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 |
Value
Pulls the time-series state-level vaccine data directly from covid19india.org.
Examples
## Not run:
get_state_vax()
## End(Not run)
List of places, abbreviations, and populations in India
Description
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.
Usage
pop
Format
A data frame with 39 rows and 3 variables: place
, abbrev
,
population
- place
The name of the place
- abbrev
The abbreviations corresponding to place
- population
The population size
References
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