nalevs takes as an input any vector and recodes it to range from 0 to 1, to treat specified levels as missing, to treat specified levels as 0, 1, .5, or the mean (weighted or unweighted) of the levels present after coding.
A vector of length equal to that of x of class numeric.
Arguments
x
A vector to be recoded to range from 0 to 1.
naset
A vector of values of x to be coded as NA.
setmid
A vector of values of x to be recoded to .5.
set1
A vector of values of x to be recoded to 1.
set0
A vector of values of x to be recoded to 0.
setmean
A vector of values of x to be recoded to the mean (if no weight is specified) or weighted mean (if a weight is specified) of values of x after all recoding.
weight
A vector of weights for x if weighted means are desired for values listed for setmean.
Author
Josh Pasek, Professor of Communication & Media and Political Science at the University of Michigan (www.joshpasek.com).