I mistakenly used by inside mutate instead of .by. But no error or warning were raised. I only found this due to a coincidence when I happen to have two pieces of code (one using by, the other using .by) producing different results.
I understand that when by= is used inside mutate, dplyr would think I am creating a new column called by with values the same as the group variable. There is nothing with the logic. I just thought an warning or something should be raised because it's such an easy mistake to make.
I mistakenly used
by
insidemutate
instead of.by
. But no error or warning were raised. I only found this due to a coincidence when I happen to have two pieces of code (one usingby
, the other using.by
) producing different results.I understand that when
by=
is used insidemutate
,dplyr
would think I am creating a new column calledby
with values the same as the group variable. There is nothing with the logic. I just thought an warning or something should be raised because it's such an easy mistake to make.Below I include a quick example