title: Drawing Cumulative Distribution Function in r
body: <p>I have the following pdf,</p>
  
  <pre><code>f(x)=2(1-x)^2;  2=&gt;x&gt;1
  </code></pre>
  
  <p>Now i have to plot the <code>cdf</code> of the random variable in <code>r</code>.</p>
  
  <pre><code>#cumulative distribution function
  
  Fx &lt;- function(x){
            (2/3) * (x^3-3*x^2+3*x-1)
        }
  
  R &lt;- runif(100,1,2)
  
  cum_prob &lt;- Fx(R) # determining cumulative probability
  </code></pre>
  
  <p>But i don't know which command should i use to draw the <code>cdf</code> .</p>
  
  <p><code>hist()</code> &amp; <code>barplot()</code> are not appropriate for cdf. Because as far i know plotting a cdf, it requires the values of random variable in X-axis, and cumulative probability in Y-axis.</p>
  
  <p>Also my variable is continuous.</p>