data(efc)
test <- to_label(efc$e42dep)
table(test)
table(to_value(test))
hist(to_value(test, 0))
# set lowest value of new variable
# to "5".
table(to_value(test, 5))
# numeric factor keeps values
dummy <- factor(c("3", "4", "6"))
table(to_value(dummy))
# non-numeric factor is converted to numeric
# starting at 1
dummy <- factor(c("D", "F", "H"))
table(to_value(dummy))
Run the code above in your browser using DataLab