Description Usage Arguments Value Author(s) Examples
View source: R/calculate_index.R
Calculate OxCGRT sub-index score for a single indicator
Calculate OxCGRT sub-index scores for all indicators
1 2 3 4 5 6 7 8 9 | calculate_subindex(indicator_code, value, flag_value)
calculate_subindices(
df,
indicator_code = "policy_type_code",
value = "policyvalue_actual",
flag_value = "flagged",
add = TRUE
)
|
indicator_code |
A character value specifying the name of the variable
in |
value |
A character value specifying the name of the column in |
flag_value |
A character value specifying the name of the column in |
df |
A data.frame containing per indicator values required for
calculating sub-index scores. This data.frame will be structured similarly
as the policy actions data.frame produced by a call to
|
add |
Logical. Should sub-indices for each indicator be added to |
A numeric value between 0 to 100.
If add
is TRUE (default), returns a tibble composed of the input
data.frame x
with an added column named score for the calculated
sub-indices. If add
is FALSE, returns a tibble of 4 columns with the
first column for the policy codes named policy_type_codes
, the second
column for the policy values named policy_value
, the third column for
the flag values named flag_value
and the fourth column named score
for
the calculated sub-indices.
Ernest Guevarra based on calculation methods by Hale, Thomas, Noam Angrist, Emily Cameron-Blake, Laura Hallas, Beatriz Kira, Saptarshi Majumdar, Anna Petherick, Toby Phillips, Helen Tatlow, Samuel Webster (2020). Oxford COVID-19 Government Response Tracker, Blavatnik School of Government.
Ernest Guevarra
1 2 3 4 5 6 7 8 | calculate_subindex(indicator_code = indicatorData$indicator[1],
value = indicatorData$value[1],
flag_value = indicatorData$flag_value[1])
x <- get_data(json = get_json_actions(ccode = "AFG",
from = NULL,
to = "2020-09-01"))
calculate_subindices(df = x$policyActions)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.