Learn R Programming

eatGADS (version 1.1.1)

checkEmptyValLabels: Check Value Labels

Description

Check value labels for (a) value labels with no occurrence in the data (checkEmptyValLabels) and (b) values with no value labels (checkMissingValLabels).

Usage

checkEmptyValLabels(
  GADSdat,
  vars = namesGADS(GADSdat),
  valueRange = NULL,
  output = c("list", "data.frame")
)

checkMissingValLabels( GADSdat, vars = namesGADS(GADSdat), classes = c("integer"), valueRange = NULL, output = c("list", "data.frame") )

Value

Returns a list of length vars or a data.frame.

Arguments

GADSdat

A GADSdat object.

vars

Character vector with the variable names to which checkValLabels() should be applied.

valueRange

[optional] Numeric vector of length 2: In which range should numeric values be checked? If specified, only numeric values are returned and strings are omitted.

output

Should the output be structured as a "list" or a "data.frame"?

classes

Character vector with the classes to which checkMissingLabels() should be applied. Valid options are "integer", "double", and "character".

Functions

  • checkEmptyValLabels(): check for superfluous value labels

  • checkMissingValLabels(): check for missing value labels

Details

NAs are excluded from this check. Designated missing codes are reported normally.

Examples

Run this code
# Check a categorical and a metric variable
checkMissingValLabels(pisa, vars = c("g8g9", "age"))
checkEmptyValLabels(pisa, vars = c("g8g9", "age"))

# Check while defining a specific value range
checkMissingValLabels(pisa, vars = c("g8g9", "age", "idschool"),
              valueRange = c(0, 5))
checkEmptyValLabels(pisa, vars = c("g8g9", "age", "idschool"),
              valueRange = c(0, 5))

Run the code above in your browser using DataLab