samedi 29 février 2020

Replace Logical OR operator using for and IF loop

I need to automate a chunk of codes for a larger model. Currently, I am using this set of codes

if(mat[1,3]>mat[2,3] ||mat[2,3] > pmat[3,3] ){
    break
  }

this is working fine. I want to dod something like this

for(y in 1:2){
    if(mat[y,3]>mat[y+1,3]){
      break
    }
  }

This is not giving me the result. Can anyone explain me? mat is a 3*3 matrix

Aucun commentaire:

Enregistrer un commentaire