this is the only code i can think of
matik=c(70, 25, 78, 90, 67, 77, 83, 99, 45, 76, 45, 24, 55, 70, 65, 75, 68,89,55,68)
AB=c(71:80)
B=c(66:70)
BC=c(61:65)
C=c(56:60)
D=c(41:55)
matik2<-matik
if(matik>=81){
print("A")
}else if(matik==AB){
print("AB")
}else if(matik==B){
print("B")
}else if(matik==BC){
print("BC")
}else if(matik==C){
print("C")
}else if(matik==D){
print("D")
}else{
print("E")
}
and when i run the code the result would be like this
[1] "E"
Warning messages:
1: In if (matik >= 81) { :
the condition has length > 1 and only the first element will be used
2: In if (matik == AB) { :
the condition has length > 1 and only the first element will be used
3: In if (matik == B) { :
the condition has length > 1 and only the first element will be used
4: In if (matik == BC) { :
the condition has length > 1 and only the first element will be used
5: In if (matik == C) { :
the condition has length > 1 and only the first element will be used
6: In matik == D :
longer object length is not a multiple of shorter object length
7: In if (matik == D) { :
ps. i am still new to R programming so i dont really many code. can you help me to find solution to this problem