I have a similar issues. As an above commenter suggested I reran it without dplyr, but that did not fix the issue.
If you managed to figure this out let me know.
For further help with those trying to debug this, I found when I remove the "by =" argument it runs just fine. So there is likely either something wrong with the way the by argument is being read, or the variable that is being passed in. Unclear what, since when I examine the variable it appears to be a generic character class. I even tried forcing it to read as a character with as.character() in the argument, but that failed too (different error claiming the variable wasn't in the data).