I'm trying to change an unordered factor into an ordered factor:
 
data96$RV961327 <- data96$V961327
data96$RV961327[data96$V961327 %in% levels(data96$V961327)[4]] <- NA
data96$RV961327[data96$V961327 %in% levels(data96$V961327)[5]] <- NA
data96$RV961327 <- factor(data96$RV961327)
attributes(data96$RV961327)
levels(data96$RV961327)
data96$RV961327
 
data96$RRV961327 <- ordered(data96$RV961327, levels=c("Oppose", "Haven't 
thought much about this", "Favor"))
attributes(data96$RRV961327)
levels(data96$RRV961327)
data96$RRV961327
cbind(data96$V961327, data96$RV961327, data96$RRV961327)
table(data96$V961327, data96$RV961327)
table(data96$V961327, data96$RRV961327)
 
The first block of code works.
 
However, when I run the ordered command, it only turns all the values into 
NA's. According to attributes, however, they have been transfered into an 
ordered factor....but still show up as NA's.
 
 
Help

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to