title: Numerical integration of numerical function in R
body: <p>I'm, trying to apply <a href="https://stats.stackexchange.com/questions/6940/calculating-p-value-from-an-arbitrary-distribution">this solution</a> to find the p-value in an arbitrary distribution defined from data experiments. I have estimated this distribution using the <a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/density.html" rel="nofollow noreferrer">density</a> function in R. Now, I would like to integrate this function to apply the solution proposed by @mpiktas. However, the <a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/integrate.html" rel="nofollow noreferrer">integrate</a> function requires a function as input, not two vectors <em>x</em> and <em>y</em> with the values that define the function, which is what density provides.</p>
  
  <p>Any idea on how to deal with this numerical integration based on <em>x</em>-<em>y</em> values in R?</p>