[Rd] Native implementation of rowMedians()

Henrik Bengtsson hb at stat.berkeley.edu
Mon May 14 11:43:45 CEST 2007


On 5/14/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Mon, 14 May 2007, Martin Maechler wrote:
>
> > Hi Henrik,
> >>>>>> "HenrikB" == Henrik Bengtsson <hb at stat.berkeley.edu>
> >>>>>>     on Sun, 13 May 2007 21:14:24 -0700 writes:
> >
> >    HenrikB> Hi,
> >    HenrikB> I've got a version of rowMedians(x, na.rm=FALSE) for matrices that
> >    HenrikB> handles missing values implemented in C.  It has been optimized for
> >    HenrikB> memory and speed.  To avoid coercing integers to doubles, and hence
> >    HenrikB> allocate an additional 200% memory, there is one C function for
> >    HenrikB> integers and one for doubles.
> >
> >    HenrikB> The rowMedians() implementation is currently sitting in my non-CRAN
> >    HenrikB> package R.native available by:
> >
> >    HenrikB> source("http://www.braju.com/R/hbLite.R")
> >    HenrikB> hbLite("R.native")
> >    HenrikB> library(R.native)
> >    HenrikB> example(rowMedians)
> >
> >    HenrikB> The source code package is available at:
> >
> >    HenrikB> http://www.braju.com/R/repos/R.native_0.1.2.tar.gz
> >
> >    HenrikB> Before I submit a package to CRAN consisting of pretty much just
> >    HenrikB> rowMedians(), would it make more sense for it to go into one of the
> >    HenrikB> core packages?  If so, how should I proceed?
> >
> > As they say: You have to convince at least one member of R-core
> > that ``it's worth it''.  {Then he may have to bear the battle
> > with dissenting core members  ;- }
> >
> > I'm quite interested, but really you have to do the work of unbundling
> > it from all the R.oo stuff before I have another longer look.
>
> Also, the 'a version of rowMedians' made me wonder what other version
> there was, and it seems there is one in Biobase which looks a more
> natural home.

The rowMedians() in Biobase utilizes rowQ() in ditto.  I actually
started of by adding support for missing values to rowQ() resulting in
the method rowQuantiles(), for which there are also internal functions
for both integer and double matrices.  rowQuantiles() is in R.native
too, but since it has much less CPU milage I wanted to wait with that.
 The rowMedians() is developed from my rowQuantiles() optimized for
the 50% quantile.

Why do you think it is more natural to host rowMedians() in Biobase
than in one of the core R packages?  Biobase comes with a lot of
overhead for people not in the Bio-world.

/Henrik

>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>



More information about the R-devel mailing list