View source: R/changeMissings.R
changeMissings | R Documentation |
Change or add missing codes of one or multiple variables as part of a GADSdat
object.
changeMissings(GADSdat, varName, value, missings)
GADSdat |
|
varName |
Character vector containing variable names. |
value |
Numeric values. |
missings |
Character vector of the new missing codes, either |
Applied to a GADSdat
or all_GADSdat
object, this function is a wrapper of
getChangeMeta
and applyChangeMeta
.
The function supports changing multiple missing tags (missings
) as well as missing tags of
multiple variables (varName
) at once.
Returns the GADSdat
object with changed meta data.
# Set a specific value to missing
pisa2 <- changeMissings(pisa, varName = "computer_age",
value = 5, missings = "miss")
# Set multiple values to missing
pisa3 <- changeMissings(pisa, varName = "computer_age",
value = 1:4,
missings = c("miss", "miss", "miss", "miss"))
# Set a specific value to not missing
pisa4 <- changeMissings(pisa2, varName = "computer_age",
value = 5, missings = "valid")
# Add missing tags to multiple variables
pisa5 <- changeMissings(pisa, varName = c("g8g9", "computer_age"),
value = c(-99, -98), missings = c("miss", "miss"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.