diff --git a/src/groupeddataframe/grouping.jl b/src/groupeddataframe/grouping.jl index 508f960211..296378d83d 100644 --- a/src/groupeddataframe/grouping.jl +++ b/src/groupeddataframe/grouping.jl @@ -343,18 +343,19 @@ combine(gd::GroupedDataFrame, f::Any) = combine(f, gd) # pair syntax function combine(gd::GroupedDataFrame, args::Union{Pair, AbstractVector{<:Pair}}...; kwargs...) - # todo: fix this bad naming + # handle pairs on their own so we can iterate + args = reduce(vcat, args) + + if args isa Pair + args = [args] + end + # nams: the name of the new variable # for the keyword arguments, this is explicitely given nams_kw = collect(propertynames(values(kwargs))) # the pair of input column => function pairs_kw = collect(values(values(kwargs))) - # handle pairs on their own so we can iterate - if args isa Pair - args = [p] - end - # For the pairs, we need to auto-generate the names of the new columns here. # i.e. :b => mean gets the name :b_mean nams_main = [Symbol(names(gd.parent)[index(gd.parent)[first(p)]],