Let's say I have a data frame with a vector:
column3
1
3
5
5
4
5
10
5
Now I want to create an entirely new vector that goes something like:
If value in column3 < 3, then value in new vector is "Small". If value in column3 >3 and <5, then value in new vector is "Medium".
I tried nested ifelse and it didn't create a new vector, it only tested one value. Example:
newcolumn <- ifelse(as.numeric(data$column3) < 3,"Small", ifelse(as.numeric(data$column3) > 3 && as.numeric(data$column3) <5, "Medium"))