This is my dataset that is to be cleaned
NCM <- c(5,1,3,2,4)
Mbrand <- c(1,5,3,4,2)
data <- data.frame(NCM,Mbrand)
data$Mbrand <- factor(data$Mbrand, levels = c(1,5,3,4,2),
labels = c("Brand1", "Brand5", "Brand3", "Brand4", "Brand2"))
Expected output:
NCM Mbrand
5 Brand1
1
3 Brand3
2
4 Brand2
How do I go about this?