recodeLookup: Recode a variable according to a lookup table
Description
Recodes the values of a variable. Function resembles the recode
function from the car package, but uses a lookup table to specify old and new values.
Usage
recodeLookup(var, lookup)
Value
a vector of the same length as var with recoded values
Arguments
var
a vector (e.g. numeric, character, or factor)
lookup
a data.frame with exact two columns. First column contains old values, second column new values.
Values which do not occur in the old column remain unchanged.