View source: R/NA_imputation.R
recover_na | R Documentation |
Using information disaggregated at different levels recovers protected information: NAs in cells that would otherwise have values 1-4. Options to impute NA-values that cannot be perfectly recovered.
recover_na(
disaggr_data,
aggr_data,
disaggr_col,
aggr_col,
var,
only_accurate = FALSE,
randomize_rest = FALSE
)
disaggr_data |
data.frame, contains the data for which NAs are to be recovered. |
aggr_data |
data.frame, contains the date on one aggregation level above. This data contains the additional information that is used to recovers NAs. |
disaggr_col |
character, is the name of the aggregation class in disaggr_data and aggr_data. |
aggr_col |
character, is the name of the aggregation class in aggr_data and disaggr_data. |
var |
character, is the name of the variable for which NAs are to be recovered. |
only_accurate |
logical, if TRUE, only replaces NA-values that can be recovered accurately.
Otherwise see |
randomize_rest |
logical, if TRUE, randomizes a value from 1:4 for those NA-values that cannot
be accurately recovered. If FALSE, evenly allocates the missing values as inferred from |
Note that randomization of the values that cannot be accurately allocated does not guarantee that the values of resulting disaggregate data will summ to the values of the aggregate data. Even allocation does ensure this.
data.frame Output is a data.frame disaggr_data with NAs recovered.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.