dict_validate: Check for potential mistakes in the dictionary

View source: R/dict_validate.R

dict_validateR Documentation

Check for potential mistakes in the dictionary

Description

Check for potential mistakes in the dictionary: 1) Whether the variable names are unique; 2) For each variable, whether there is a unique mapping between level and label and whether the levels are consecutive; and extract unique level-label pairings.

Usage

dict_validate(dict)

Arguments

dict

A variable dictionary returned by dict_generate.

Value

If no mistake found in the dictionary, a dataframe containing the unique level-label pairings. If mistakes found in the dictionary, a list containing the above dataframe and a list with components

  • non_unique_names - A dataframe containing qids with non-unique names and their names

  • mistake - A dataframe containing qids with one of the following mistakes and mistake code: not one-to-one mapping between labels and levels (1), levels not increasing in step of 1 (2), duplicated levels (3) and duplicated labels (4).

Examples

## Not run: 

# Create a dictionary
mydict <- dict_generate("SV_4YyAHbAxpdbzacl",
  name = "easy_name",
  block_pattern = block_pattern,
  block_sep = ".",
  split_by_block = FALSE
)


# Validate the dictionary
validation <- dict_validate(mydict)

## End(Not run)


lyh970817/qualtdict documentation built on April 8, 2023, 9:26 p.m.