title: Use dplyr::percent_rank() to compute percentile ranks within group
body: <p>Suppose I have the following data:</p>
  
  <pre><code>id    grpvar1    grpvar2    value
  1     1          3          7.6
  2     1          2          4
  ...
  3     1          5          2
  </code></pre>
  
  <p>For each <code>id</code>, I want to compute the <code>percent_rank()</code> of its <code>value</code> within the group defined by the combination of <code>grpvar1</code> and <code>grpvar2</code>.</p>
  
  <p>Using <code>data.table</code>, I would go (assuming I my data is in a <code>data.frame</code> called <code>dataf</code>:</p>
  
  <pre><code>library(data.table)
  
  # Make dataset into a data.table.
  dt &lt;- data.table(dataf)
  
  # Calculate the percentiles.
  dt[, percrank := rank(value)/length(value), by = c("grpvar1", "grpvar2")]
  </code></pre>
  
  <p>What is the equivalent in <code>dplyr</code>?</p>