title: Calculate probability from density function
body: <p>I've build density function and now I want to calculate the probability of a new data point to "fall" into selected interval (say, a=3, b=7). So, I'm looking for:</p>
  
  <pre><code>P(a&lt;x&lt;=b)
  </code></pre>
  
  <p>Some sample data:</p>
  
  <pre><code>df&lt;- data.frame(x=c(sample(6:9, 50, replace=TRUE), sample(18:23, 25, replace=TRUE)))
  
  dens&lt;- density(df$x)
  </code></pre>
  
  <p>I'll be happy to hear of any solution, but preferably in <em>base r</em></p>
  
  <p>Thank you in advance</p>