The R Project SVN R

Rev

Rev 68948 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68948 Rev 80079
Line 78... Line 78...
78
tw <- rnorm(3)
78
tw <- rnorm(3)
79
x1 <- myIter(BigData = rnorm(1000), twiddle = tw) # OK, not REALLY big
79
x1 <- myIter(BigData = rnorm(1000), twiddle = tw) # OK, not REALLY big
80
 
80
 
81
twiddler <- function(x, n) {
81
twiddler <- function(x, n) {
82
  x$ensureLocal() # see the Details.  Not really needed in this example
82
  x$ensureLocal() # see the Details.  Not really needed in this example
83
  for(i in seq(length = n)) {
83
  for(i in seq_len(n)) {
84
      x$twiddle <- x$twiddle + rnorm(length(x$twiddle))
84
      x$twiddle <- x$twiddle + rnorm(length(x$twiddle))
85
      ## then do something ....
85
      ## then do something ....
86
      ## Snooping in gdb, etc will show that x$BigData is not copied
86
      ## Snooping in gdb, etc will show that x$BigData is not copied
87
  }
87
  }
88
  return(x)
88
  return(x)