lundi 4 octobre 2021

Incrementing with if statement in R

I'm trying to write a function in RStudio where I can increment 1 by 1 through a matrix and compare different cell values. I wrote this if statement to test how this would work but I'm getting an error and my function wont run. The error is stated below with my written code.

Error in infection_step(1, 1) : unused argument (1)

  
  if (m2[x,y] = 1) {
    
      print("equals 1")
    
      }
  
  else {
    
      x <- x+1
      y <- y+1
    
    }
  
  }

Aucun commentaire:

Enregistrer un commentaire