I'm no expeRt, but suppose that we change the setup slightly:
xx - x[sample(nrow(x)), ]
Now what would you like
aggregate(value ~ group + year, data=xx, FUN=function(z) z[1])
to return?
Personally, I prefer to have R return the same thing regardless
of how the input dataframe is
Dear expeRts,
The question is rather simple: Why does aggregate (or similarly tapply()) not
keep the order of the grouping variable(s)?
Here is an example:
x - data.frame(group = rep(LETTERS[1:2], each=10),
year = rep(rep(2001:2005, each=2), 2),
value =
On 2013-03-11 13:52, Marius Hofert wrote:
Dear expeRts,
The question is rather simple: Why does aggregate (or similarly tapply()) not
keep the order of the grouping variable(s)?
Here is an example:
x - data.frame(group = rep(LETTERS[1:2], each=10),
year = rep(rep(2001:2005,
3 matches
Mail list logo