I have a data set with a continuous variable, and I want to split it up into factors.
This is my code so far:
data$pgr<-as.character(data$pgr)
data$pgr[data$pgr <= 7] <- "<= 7 progesterone receptors"
data$pgr[data$pgr > 7 & data$pgr <= 32.5] <- "7-32.5 progesterone receptors"
data$pgr[data$pgr > 32.5 & data$pgr <= 131.8] <- "32.5-131.8 progesterone receptors"
data$pgr[data$pgr > 131.8] <- "> 131.8 progesterone receptors"
data$pgr<-as.factor(data$pgr)
The thing is, it worked for a different variable when I only used one double inequality but won't work for this one? The <=7 and >131.8 both work.
I thought you have to use a double && but, for my other variable it only worked with a singular &. For this one, it works for neither.
Please could someone explain this to me/how to change my code? I would appreciate it.