Skip to contents

This function revalues variables in a dataset according to the specifications provided in a codebook.

Usage

RevalueData(DatatoRevalue, VarTypes, missingVal = -999, splitchar = ";")

Arguments

DatatoRevalue

The dataset to be revalued.

VarTypes

A data frame containing information about the variables and how they should be revalued. It should have columns: Variable (variable names), Recode (yes/no for recoding), Code (the revalue codes separated by ","), Type (Categorical, Double, or Ordinal), and Label (optional label for the variable).

missingVal

The value to use for missing values (default is -999).

splitchar

The character used to split codes in the Code column (default is ";").

Value

A list containing the revalued dataset, a warning list, and a list of recoded variables.