A while ago, Alan sent this implementation of accumarray:
function accumarray(subs, val, fun=sum, fillval=0; sz=maximum(subs,1),
issparse=false)
counts = Dict()
for i = 1:size(subs,1)
counts[subs[i,:]]=[get(counts,subs[i,:],[]),val[i...]]
end
A = fillval*ones(sz...)
for j = keys(counts)
A[j...] = fun(counts[j])
end
issparse ? sparse(A) : A
end
It's not completely idiomatic, but it's pretty good and might be helpful.
On Thu, Mar 20, 2014 at 3:49 PM, Tom Short <[email protected]> wrote:
> The DataFrames package has operations on groupings:
>
> http://juliastats.github.io/DataFrames.jl/split_apply_combine.html
>
> It's more like PLYR than tapply, but it may be of use to you. I've
> also been experimenting with some different APIs related to this:
>
>
> https://github.com/JuliaStats/DataFramesMeta.jl#operations-on-groupeddataframes
>
>
>
>
> On Thu, Mar 20, 2014 at 1:46 PM, James Johndrow
> <[email protected]> wrote:
> > I cannot seem to find a built-in julia function that performs the
> function
> > of tapply in R or accumarray in matlab. Anyone know of one?
>