Skip to content
Prev 250469 / 398498 Next

Help optimizing EMD::extrema()

I did not try to emulate the ndata nad ndatam1 arguments
to extrema(), as I didn't see what they were for.  The
help file simply says they are the length of the first
argument and that minus 1 and that is what their default
values are.  If they do not have their default values
then extrema() frequently dies.  You could add them them
to the argument list and not use them, or check that
they are what they default to, as in
   function(x, ndata, ndatam1) {
      stopifnot(length(x)==ndata, ndata-1==ndatam1)
      ... rest of code ...
If the check fails then someone needs to say or figure out
what they are for.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com