[R] Pass By Value Questions
lists at jdadesign.net
lists at jdadesign.net
Thu Aug 19 18:57:49 CEST 2010
I understand R is a "Pass-By-Value" language. I have a few practical
questions, however.
I'm dealing with a "large" dataset (~1GB) and so my understanding of the
nuances of memory usage in R is becoming important.
In an example such as:
> d <- read.csv("file.csv");
> n <- apply(d, 1, sum);
must "d" be copied to another location in memory in order to be used by
apply? In general, is copying only done when a variable is updated within
a function?
Would the following example be any different in terms of memory usage?
> d <- read.csv("file.csv");
> n <- apply(d[,2:10], 1, sum);
or can R reference the original "d" object since no changes to the object
are being made?
I'm familiar with FF and BigMemory, but are there any packages/tricks
which allow for passing such objects by reference without having to code
in C?
Regards,
Jeff Allen
More information about the R-help
mailing list