title: Call a function with multiple arguments inside uniroot in R
body: <p>I am trying to call a function with multiple arguments inside uniroot, to solve and find the value of x. Code below,</p>
  
  <pre><code>mean1 = 0
  mean2 = 1
  
  sigma1 = 0.5
  sigma2 = 0.5
  
  priors1 = 0.6
  priors2 = 0.1
  
  threshold = function(mu1, sigma1, mu2, sigma2, prior1, prior2, x) {
      (dnorm(x,mu1,sigma1) * prior1 - dnorm(x, mu2, sigma2) * prior2) 
  }
  
  uniroot(threshold(mean1,sigma1,mean2,sigma2, priors1, priors2), c(0,5))
  </code></pre>
  
  <p>But the call to uniroot fails, since the function expects x to be passed as well. How do i solve this?</p>