Your sample data wasn't grouped so I had no way to know that in advance, to avoid this kind of issues next time make your question with a self-contained REPRoducible EXample (reprex)
If your question's been answered, would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: