View source: R/md_clean_data.R
md_clean_data | R Documentation |
Clean microdata to be used in PIP methods.
md_clean_data(dt, welfare, weight = NULL, quiet = FALSE)
dt |
data.frame: A table with survey data. |
welfare |
character: Name of welfare column. |
weight |
character: Name of weight column. Optional. |
quiet |
logical: If TRUE output messages are suppressed. |
md_clean_data()
returns a list of elements whose main object is a
data.table with the necessary transformations to be included in PIP methods.
Data is available in element $data
. The other elements provide the number
of observations that were modified depending on test performed. The name of
elements are in the form p_s, where p (or prefix) refers to the test and s
(the suffix) refers to the name of the variable evaluated.
Prefixes are:
nna: Number of NA in variable
nng: Number of negative values
ina: Index of obs with NA in variable
ing: Index of obs with negative values
list
# Load example data
data("md_GHI_2000_income")
# Clean microdata
res <- wbpip:::md_clean_data(
md_GHI_2000_income,
welfare = "welfare",
weight = "weight")
res$data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.