I have looked but I just don't understand why im getting this error. I want to allocate a number in CNSTATUS depending on the integer value in the column CN If less than 10, the CNSTATUS should be 10, if between 10 and 20 CNSTATUS shuold be 2 and if more than 20 it should be 3
CN is an integer column
My dataframe
CN CNSTATUS
2
12
43
2
4
My code:
if(OCCAMSdbTumCN$CN < 10) {
OCCAMSdbTumCN$CNSTATUS <- 1
}
else if(OCCAMSdbTumCN$CN > 10 & OCCAMSdbTumCN$CN<20) {
OCCAMSdbTumCN$CNSTATUS <- 2
}
else{
OCCAMSdbTumCN$CNSTATUS <- 2}
The error I am getting is
In if (OCCAMSdbTumCN$CN < 10) { :
the condition has length > 1 and only the first element will be used