From therneau at mayo.edu  Wed Oct  3 14:50:45 2012
From: therneau at mayo.edu (Terry Therneau)
Date: Wed, 03 Oct 2012 07:50:45 -0500
Subject: [Rd] Fastest non-overlapping binning mean function out there?
In-Reply-To: <mailman.29.1349258410.27737.r-devel@r-project.org>
References: <mailman.29.1349258410.27737.r-devel@r-project.org>
Message-ID: <506C34A5.8000603@mayo.edu>

Look at rowsum.  It's pretty fast C code.

Terry T

On 10/03/2012 05:00 AM, r-devel-request at r-project.org wrote:
> Hi,
>
> I'm looking for a super-duper fast mean/sum binning implementation
> available in R, and before implementing z = binnedMeans(x y) in native
> code myself, does any one know of an existing function/package for
> this?  I'm sure it already exists.  So, given data (x,y) and B bins
> bx[1]<  bx[2]<  ...<  bx[B]<  bx[B+1], I'd like to calculate the
> binned means (or sums) 'z' such that z[1] = mean(x[bx[1]<= x&  x<
> bx[2]]), z[2] = mean(x[bx[2]<= x&  x<  bx[3]]), .... z[B].  Let's
> assume there are no missing values and 'x' and 'bx' is already
> ordered.  The length of 'x' is in the order of 10,000-millions.  The
> number of elements in each bin vary.
>
> Thanks,
>
> Henrik



[Rd] Fastest non-overlapping binning mean function out there?
Terry Therneau