title: unused argument in function in R
body: <p>I'm new to R and trying to use the acceptance rejection method to generate a standard normal variable as part of an an assignment and I can't figure out where I'm off in defining this function.  I've looked through other cases with the unused argument error, but they seem to be related to having extra variables as input, which I don't believe I do.  Can someone explain why this happens?  I would really like to understand better how R works.</p>
  
  <pre><code>AR&lt;-function(u1,u2){
      y1=(-1)*(log(u1))
      y2=(-1)*(log(u2))
      condition=(((y1)-1)*((y1)-1))/2
      u3=runif(1)
      ifelse(u3&gt;=0.5,zz=abs(z),zz=(-1)*(abs(z)))
  }
  
  u1=runif(1)
  u2=runif(1)
  AR(u1,u2)
  # Error in ifelse(u3 &gt;= 0.5, zz = abs(z), zz = (-1) * (abs(z))) : 
  #  unused argument(s) (zz = abs(z), zz = (-1) * (abs(z)))
  </code></pre>