title: R: Integrating over a polygon
body: <p>I want to integrate over a polygon, I have been tryig with the polyCub.SV() function from the mvtnorm package:</p>
  
  <pre><code>#defining the covariate function:
  
  elev.fn&lt;-function(s){
    s&lt;- matrix(s,ncol=2)
    (s[,1]+s[,2]-100)/40.8
  }
  
  
  mu &lt;- function(s,beta0,beta1) exp(beta0+beta1*elev.fn(s=s))
  
  
  polyCub.SV(Mypolygon,f=mu,beta0=beta0,beta1=beta1,nGQ=2,rotation=FALSE)
  </code></pre>
  
  <p>the result is NAN</p>
  
  <p>What am I doing wrong?</p>