0

Recently I'm using aggregate function (stats package) and I noticed that it produces different results by different syntax I use.

Two type of syntax I used are:

  • aggregate(x~y, data, fun)
  • aggregate(data[...], by=list(...), fun)

Is it possible that aggregate function produces different results? Or different syntax could produce same results?

For the first type of syntax I noticed that produce different result when I use cbind to define variables to aggregate.

Thanks.

viesse
  • 1
  • 1
  • 2
    `aggregate` is from base R. That said, those syntaxes should produce the same result – Maël Aug 24 '22 at 15:08
  • Please provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that shows the behavior you are observing. You are not using `dplyr` here. – MrFlick Aug 24 '22 at 15:16
  • It should be same output except that the column names remain same in the formula method – akrun Aug 24 '22 at 15:20

0 Answers0