I have a data frame that looks something like this:

| ID | Time | Value |
| --- | --- | --- |
| A | 0 | 84 |
| A | 1 | 90 |
| A | 2 | 76 |
| A | 3 | 98 |
| B | 0 | 64 |
| B | 1 | 81 |
| C | 0 | 89 |
| C | 1 | 76 |

I need to take the mean of the first 10% of values for each ID.

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.

I have attempted map2 and lapply, but I cannot quite get it to work.