[R] Q: replacing elements in an array

Laurent Gautier laurent at cbs.dtu.dk
Tue Aug 13 17:26:38 CEST 2002


Dear all,


I have a question about the way the replacement of elements in an array
works in R (having a slight idea of the answer), and a question about
the way to achieve my goals.

If I have a 3 ways-array called 'a', the command

a[1, , ] <- rnorm(10)  # assumes the size matches

will result in having the whole object 'a' copied (since arrays are
just 'vectors with dimensions' in R) ... and at some point
two objects like 'a' will be in memory, right ? (this was the first
question).

I have rather large arrays, and I would like to modify some of their
elements in-situ (to save memory). Is there a way to do that ?


Thanks,






Laurent

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list