I have a variable (V7) in dataset (total observation is 137) range from 0 to 100, I would like to create a new variable (V12) which it group the variable (V7) into 3 groups with 75-100,60-74, 0-59. I use
if(data$V7>="75"){
V12 <- 1
} else {
if(data$V7>="60"){
V12 <- 2
} else {
V12 <- 3
}
}
but I get Warning messages: 1: In if (data$V7 >= "75") { : the condition has length > 1 and only the first element will be used 2: In if (data$V7 >= "60") { : the condition has length > 1 and only the first element will be used
Anyone could help me on this matter? Thanks!