1
volume_info <- group_by(volume_info, Date)
volume_info <- summarize(volume_info, `Volume on Date` = sum(Volume))

The first line groups by a column "Date", while the second line takes the sum of another column "Volume". On one account on my laptop and on my desktop, this works fine. However, on a different account on the same laptop (a "work" account), this throws a warning:

summarise() regrouping output by 'year' (override with .groups argument)

This then causes an error later on. In that machine, if I add the argument .groups = "drop", the code works fine.

So I thought I'd just add .groups = "drop" everywhere. But then: in the machines where the original code works, what is happening is that a new column named ".group" is being added and it is filled with the value "drop"!

What is happening and how do I get the same behaviour across all machines -- especially, what's the "correct" behaviour if I want to collaborate? The code on my colleague's machines seem to work only when .groups = "drop" is not present.

WorldGov
  • 157
  • 6
  • 4
    Can you check the dplyr version in those different machines. The `.groups` lifecycle is experimental and it works in 1.0.0. The correct approach would be to test it with the same versions or dplyr. – akrun Jun 30 '20 at 20:41

1 Answers1

1

Try to check your R and packages versions with running:

sessionInfo()

You probably have a different versions of software accross machines. Particularly in your case it seems to be a newer version of dplyr package, try that on your different machines:

packageVersion("dplyr")
#> [1] ‘1.0.0’

The message about regrouping output is only for your information to be clear what happens with your data frame during summarizing. It is not a warning nor error.

For more information about grouping see also: