[Rd] Get memory address of an R data frame

Stepan @tep@n@@|nde|@r @end|ng |rom or@c|e@com
Thu Jan 9 15:56:45 CET 2020

On 09. 01. 20 15:41, lille stor wrote:

> I believe this could be done without creating side effects (e.g. 
> crash) as we are just talking about changing values.

that is exactly the issue that my last two points warn about. Example:

a <- mtcars
.Call("my_innocent_function", a)

Would you expect that mtcars data.frame would be altered after this code 
is executed? What if some existing code relies on mtcars always 
containing the same data, which is a perfectly valid assumption given R 

If what you are trying to do is to have mutable data frame, then this 
goes against the philosophy of R. You can get mutability with 
environments and other R types that are intentionally mutable and their 
mutability is documented.

You can get data.frame mutability with the data.table package, but the 
tricks it's doing under the hood may bite back. In its source code you 
can also see how these things can be done, but unless you really need 
to, I would advise against implementing this yourself.


More information about the R-devel mailing list