Avoiding deep copies
Johann Petrak <johann at ai.univie.ac.at> writes:
Is it correct that there is no way of avoiding deep copying of data structures? Or asked from a different perspective, is it true that there are no pointers? :) (not that I am a fan of pointer, they just let me decide when to do deep copy on my own when the memory manager doesnt do it for me :) ) I was considering writing code in R that would need the internal representation of complex graph structures where several nodes in the graph point to the same huge array of data. Now, obviously one cannot just do something like attr(thenode,"mydatavec")<-thedatavec or thenode$mydatavec<-thedatavec since all the data in thedatavec will be copied with this assignment. Are there commonly accepted/used workarounds?
Some ideas are being bandied about on this issue, but it isn't all that easy. We've had the .Alias mechanism for a while, but it is a very dirty hack, and people are wanting to remove it. You could have a look at Luke Tierney's notes on this and related matters if you care: http://www.stat.umn.edu/~luke/R/simpleref.html
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._