plyr
Error in Changing Factors with PLYR in R
for the purposes of GLM modeling, I am trying to change the qualitative values for a variable to quantitative "dummy" variables. For this exercise, I am using Plyr, which seems incredibly intuitive over base R. str(data$Socks) $ Socks : Factor w/ 4 levels "1+","2+","4+","8+" ..: 1 4 4 1 4 4 1 4 1 1 ... levels(data$Socks) [1] "1" "2+" "4+" "8+" library(dplyr) select(data, Socks) 2 8+ 3 8+ 4 1 5 8+ When I try to change the levels, every factor but 1 is changed to an "NA". data <- data %>% mutate(Socks = factor(Socks, levels = c(1, 2, 4, 8))) select(data, Socks) 990 1 991 <NA> 992 1 993 <NA> I would like the values "1","2+","4+","8+" to change to "1", "2", "4", "8". Any help would be appreciated. Thank you!
Related Links
Likelihood over subgroups
Error in Changing Factors with PLYR in R
Frequency table in R
Installation of plyr in R on Ubuntu does not work
Issue installing library(plyr) in R (Windows)