I did loop with if statement as you can see in the code
for (j in 2:4){
for (i in 1:5-j){
if (B[i,5-j]>10){
A[i,j] = 0
}else{
A[i,j] = 2
}
}
}
But it doesn´t work.
In if (B[i, 5 - j] > 10) {
the condition has length > 1 and only the first element will be used.
I don't know how it works fine.