title: How to plot a CDF functon from PDF in R
body: <p>I have the following function:</p>
  
  <pre><code>fx &lt;- function(x) {
    if(x &gt;= 0 &amp;&amp; x &lt; 3) {
      res &lt;-  0.2;
    } else if(x &gt;=3 &amp;&amp; x &lt; 5) {
      res &lt;- 0.05;
    } else if(x &gt;= 5 &amp;&amp; x &lt; 6) {
      res &lt;-  0.15;
    } else if(x &gt;= 7 &amp;&amp; x &lt; 10) {
      res &lt;-  0.05;
    } else {
      res &lt;- 0;
    }
  
    return(res);
  }
  </code></pre>
  
  <p>How can I plot it's <a href="https://en.wikipedia.org/wiki/Cumulative_distribution_function" rel="nofollow noreferrer">CDF</a> function on the interval <code>[0,10]</code>?</p>