[R] Large arrays and reference passing

Mark White mjw at celos.net
Wed Oct 13 19:32:20 CEST 2004

I'm one of the handful of people using R on very large
numerical arrays; in my case, magnetic resonance images.

The speed/memory issues of pass-by-value when writing
functions (both R or .Call/.External) that update regions of
large arrays have been discussed before, and there are
several possible workarounds ('references' implemented with
environments, <<-, R_MakeExternalPointer for opaque
wrapping, monolithic functions).  I've tried some of them
and am trying to settle on an approach that works well.

Does anybody have experience relating to what works fastest,
or suggestions for how to write R code in a way that avoids
excessive copying of large arrays?  In my case most (though
not all) of the number crunching is done in C.

Mark <><

More information about the R-help mailing list