[R] Deep copy in R

Shin, Daehyok sdhyok at email.unc.edu
Mon Apr 5 22:57:15 CEST 2004


I am handling spatial data of huge volumes,
so sensitive to the silent duplication of data in script programs.
In the following R program, exactly when is the vector data deeply copied?
Thanks in advance.

1 v <- 1:10000
2 z <- f(v)

--------- function f ----------
3 f <- function(x) {
4   y = x                               
5   y[10] = 1
6   xf = date.frame(x=x)
7   xf$x[10] = 1
8   return(y)
}

Daehyok Shin
Terrestrial Hydrological Ecosystem Modellers
Geography Department
University of North Carolina-Chapel Hill
sdhyok at email.unc.edu

"We can do no great things, 
only small things with great love."
                         - Mother Teresa




More information about the R-help mailing list