simple question. I want to add bracket for column b as per below. I tried ifelse but only gets the final one and i do not know how to nest it?
a <- c(1,2,3,4,5)
b <- c(5,10,15,16,17)
bracket <- c("5 - 10 days", "10-15 days","10-15 days", "More then 15", "More then 15")
df <- data.frame(a,b,bracket)
So the result is 'bracket' column.
I tried below with no luck
df$bracket <- ifelse (df$b> 15 ,"More then 15",NA)
df$bracket <- ifelse (df$b <= 15 & df$b > 10,"10-15 days",NA)
df$bracket <- ifelse (df$b <= 10 & df$b > 5,"5 - 10 days",NA)