Thanks for the input, but it looks like I found a simple solution.
Turns out that if you assign to lists by name, then R doesn't make extra
copies:
x-double(10^9)
mylist-list()
system.time(mylist[[1]]-x)
user system elapsed
2.992 3.352 6.364
x-double(10^9)
mylist-list()
Usually R is pretty good about not copying objects when it doesn't need
to. However, the list() function seems to make unnecessary copies. For
example:
system.time(x-double(10^9))
user system elapsed
1.772 4.280 7.017
system.time(y-double(10^9))
user system elapsed
2.564
2 matches
Mail list logo