| nalevs {weights} | R Documentation |
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.
nalevs(x, naset=NULL, setmid=NULL, set1=NULL, set0=NULL, setmean=NULL, weight=NULL)
x |
A vector to be recoded to range from 0 to 1. |
naset |
A vector of values of |
setmid |
A vector of values of |
set1 |
A vector of values of |
set0 |
A vector of values of |
setmean |
A vector of values of |
weight |
A vector of weights for |
A vector of length equal to that of x of class numeric.
Josh Pasek, Assistant Professor of Communication Studies at the University of Michigan (www.joshpasek.com).
data(anes04) summary(anes04$age) summary(nalevs(anes04$age)) table(anes04$educcats) table(nalevs(anes04$educcats, naset=c(2, 4)))