[R] Any concept of 'by reference' or 'address of' in R?

David Winsemius dwinsemius at comcast.net
Sat Sep 19 01:48:55 CEST 2009


On Sep 18, 2009, at 7:38 PM, Mark Knecht wrote:

> Hi,
>   Is there a way to pass the address of a data.frame through a set of
> functions in R? I've got some code which is slowing down I think
> because my data.frames are getting much larger - now approaching 1
> million rows by 50-100 columns - and my functions - originally written
> for much smaller data elements are sampling these data.frames a couple
> of layers down.
>
>   Before I rewrite them to do the sampling at the top level if there
> was a way to pass the address of the data.frame instead of the a copy
> of the whole thing then I suspect that would speed things up
> significantly.
>

You could pass <it>'s name as a string and then when it arrived at the  
destination, ... get() it:

?get

-- 
David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list