quick question: Can somebody tell me how I do the following in the dplyr syntax?
p4[,1:5] <- lapply(p4[,1:5] , factor)
Col 1 - 5 were characters and I wanted them to be factors. However, with dplyr I didnt get the job done. My guess was:
df <- df %>% select(1:5) %>% mutate(as_factor)
But that drops all other columns because of the select function. Also, mutate_if is not really helpful here because I have other cols that are characters which I dont want to be changed.
Thank you very much.