I have a data frame with a column of characters. I am trying to change this column to a ordered factors, but everytime I try to use factor(), the entire column is transformed into NAs. However, if I delete the "labels" parameter, it works just fine. I wanted to understand why I am getting this wrong.
I tried using:
data[3] <- factor(data[3], levels = c(1:4), labels = c("Ensino médio completo", "Ensino superior incompleto","Ensino superior completo","Pós-graduado"), ordered = T)
but this just makes all the characters strings be transformed into NAs. Although, trying the following "worked":
data[3] <- factor(data[3], levels = c("Ensino médio completo", "Ensino superior incompleto", "Ensino superior completo","Pós-graduado"), ordered = T)