changeMissings {eatGADS}R Documentation

Change missing code.

Description

Change or add missing codes of a variable as part of a GADSdat or all_GADSdat object.

Usage

changeMissings(GADSdat, varName, value, missings)

Arguments

GADSdat

GADSdat object imported via eatGADS.

varName

Character string of a variable name.

value

Numeric values.

missings

Character string of the new missing codes, either "miss" or "valid".

Details

Applied to a GADSdat or all_GADSdat object, this function is a wrapper of getChangeMeta and applyChangeMeta.

Value

Returns the GADSdat object with changed meta data.

Examples

# 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")


[Package eatGADS version 1.1.0 Index]