[Rd] Shallow copies

Matthieu Gomez gomez.matthieu at gmail.com
Tue Sep 30 23:20:48 CEST 2014


I have a question about shallow copies in R. Since R 3.1.0, subsetting
a dataframe with respect to its columns no longer result in deep
copies. This is an amazing change in my opinion. Now, subsetting a
data.frame by rows (or subsetting a matrix by columns or rows) still
does deep copies. In particular, it is my understanding that running a
command on a very large subset of rows (say "sum" or "biglm" on non
outliers observations) results in a deep copy of these rows first,
which can require twice as much the memory of the original
data.frame/matrix. If this is correct, I would be very interested to
know more on whether this behavior can/may change in future versions
of R.

Thanks a lot!,
Matthew



More information about the R-devel mailing list