You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dcast.data.table should be able to handle multiple aggregation functions #716
Aggregation is not cheap (esp. on large data) and it'd be great to have multiple aggregations done in the same cast function call. Roughly I'm thinking it should be something like:
Idea: If value.var is a character vector or length=1 list, then fun.aggregate will be applied to all those columns. Else if value.var is a list AND length(value.var) == number of functions, then apply each one to that function.
Any chance of adding an option to have the columns in the result alternate, like v1_sum_value1, then v1_sum_value2, etc.? I used the multi-arg value.var over on SO and couldn't find a nice way to reorder the columns like that: http://stackoverflow.com/a/32570910/1191259
Activity
dcast takes multiple 'value.vars' and fun.agg. Closes #739, #716.
arunsrinivasan commentedon Nov 14, 2014
Implemented in commit fc753c2 in 1.9.8. Will merge and add news later.
arunsrinivasan commentedon Nov 18, 2014
fun.aggregateargumentvalue.varto be list insteadFinal setting should be more or less:
which is a lot of "bla" and redundancy. Instead it could be:
Idea: If
value.varis a character vector or length=1 list, thenfun.aggregatewill be applied to all those columns. Else ifvalue.varis a list AND length(value.var) == number of functions, then apply each one to that function.arunsrinivasan commentedon Mar 15, 2015
Done.
franknarf1 commentedon Sep 14, 2015
Any chance of adding an option to have the columns in the result alternate, like
v1_sum_value1, thenv1_sum_value2, etc.? I used the multi-argvalue.varover on SO and couldn't find a nice way to reorder the columns like that: http://stackoverflow.com/a/32570910/1191259UweBlock commentedon Apr 27, 2017
I would like to second @franknarf1. Here is another case on SO where an option to reorder the columns in an alternating way would have been handy: http://stackoverflow.com/a/43650705/3817004