title: Average of Values of Different Percentage Lengths
body: <p>I have a data frame that looks something like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>ID</th>
  <th>Time</th>
  <th>Value</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>0</td>
  <td>84</td>
  </tr>
  <tr>
  <td>A</td>
  <td>1</td>
  <td>90</td>
  </tr>
  <tr>
  <td>A</td>
  <td>2</td>
  <td>76</td>
  </tr>
  <tr>
  <td>A</td>
  <td>3</td>
  <td>98</td>
  </tr>
  <tr>
  <td>B</td>
  <td>0</td>
  <td>64</td>
  </tr>
  <tr>
  <td>B</td>
  <td>1</td>
  <td>81</td>
  </tr>
  <tr>
  <td>C</td>
  <td>0</td>
  <td>89</td>
  </tr>
  <tr>
  <td>C</td>
  <td>1</td>
  <td>76</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I need to take the mean of the first 10% of values for each ID.</p>
  <p>I used to do a similar process with the slice_head function, but previously I had taken the same length for each variable and used aggregate (grouped by ID) with the new data frame. Now that the lengths of each ID are different, slice keeps giving an error.</p>
  <p>I have attempted map2 and lapply, but I cannot quite get it to work.</p>