impute_down | R Documentation |
This is a generic function to impute data from broader hierarchical geographical areas to smaller ones. It requires the exact specification of the of the geographical typology.
impute_down( upstream_data = NULL, downstream_data = NULL, country_var = "country_code", regional_code = "geo_code", values_var = "values", time_var = NULL, upstream_method_var = NULL, downstream_method_var = NULL )
upstream_data |
An upstream data frame to project on containing smaller geographical units, for example, country-level data. |
downstream_data |
A downstream data frame containing the smaller level missing data observations. It must contain all the necessary structural information for imputation. |
country_var |
The geographical ID of the upstream data,
defaults to |
regional_code |
The geographical ID of the downstream data,
defaults to |
values_var |
The variable that contains the upstream data to be
imputed to the downstream data, defaults to |
time_var |
The time component, if present, defaults to
|
upstream_method_var |
The name of the variable that contains the
potentially applied imputation methods. Defaults to |
downstream_method_var |
The name of the variable that will contain
the metadata of the potentially applied imputation methods.
Defaults to |
The more general impute_down
function requires typology information from the higher
and lower level typologies. This is not needed when the EU vocabulary
is used, and the hierarchy can be established from the EU vocabularies.
The upstream data frame (containing data of a larger unit) and
the downstream data (containing data of smaller sub-divisional units) are
joined; whenever data is missing in the downstream sub-divisional column,
it is imputed with the corresponding values from the upstream data frame.
The 'method'
metadata column explains if the actual downstream
data or the imputed data can be found in the downstream value column.
Other impute functions:
impute_down_nuts()
{ upstream <- data.frame ( country_code = rep( "AU", 3), year = c(2018:2020), my_var = c(10,12,11), description = c("note1", NA_character_, "note3") ) downstream <- australia_states impute_down ( upstream_data = upstream, downstream_data = downstream, country_var = "country_code", regional_code = "geo_code", values_var = "my_var", time_var = "year" ) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.