title: new to R, receiving an error in my function
body: <pre><code>true_RA&lt;-seq(-2,2 ,length.out = 13)  #true vector with -2&lt;RA&lt;2 in
  # even intervals for 13 players 
  
  true_RA
  
  current_RA&lt;-true_RA   #assign true_RA to the current ratings
  
  ratings_overtime&lt;-matrix(current_RA, nrow=13, ncol=10,000) #create a #matrix of 13 players
  # and 10000 ratings 
  
  p&lt;-0.5825702
  
  simulate_game&lt;-function(i,j){
      old_RA_i&lt;-current_RA[i] #assign the rate from 
  #my current rating vector from vector 
  
      old_RA_j&lt;-current_RA[j]
      win&lt;rbinom(1,1,p)
  if (win==1){current_RA_i&lt;-old_RA_j+400}
  else{current_RA_j&lt;-old_RA_i+400}
  }  
   return(c(current_RA_i,current_RA_j))
  }
  </code></pre>
  <p>my function should do simulates a game between players i and j given their true underlying ratings from <code>rbinom(1,1,p)</code>.
  I am getting an Error: object 'current_RA_i' not found.</p>