title: R ggplot: Weighted CDF
body: <p>I'd like to plot a weighted CDF using <code>ggplot</code>. Some old non-SO discussions (e.g. <a href="https://stat.ethz.ch/pipermail/r-help//2012-October/337288.html" rel="noreferrer">this</a> from 2012) suggest this is not possible, but thought I'd reraise.</p>
  
  <p>For example, consider this data:</p>
  
  <pre><code>df &lt;- data.frame(x=sort(runif(100)), w=1:100)
  </code></pre>
  
  <p>I can show an unweighted CDF with</p>
  
  <pre><code>ggplot(df, aes(x)) + stat_ecdf()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/m6y9w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/m6y9w.png" alt="enter image description here"></a></p>
  
  <p>How would I weight this by <code>w</code>? For this example, I'd expect an <code>x^2</code>-looking function, since the larger numbers have higher weight.</p>