[Rd] Get memory address of an R data frame

Joris Meys jor|@mey@ @end|ng |rom gm@||@com
Thu Jan 9 13:58:19 CET 2020


Hi Lille,

To my understanding, there's no need to get the actual memory address of
the R data frame, as using .Call() or .External() can be used in a "call by
reference" way as well. This would be contrary to standard R behaviour, so
if you use that in a package, make sure you indicate this!

There's a detailed explanation on how to deal with R objects in C code in
the manual "Writing R extensions" here :

https://cran.r-project.org/doc/manuals/R-exts.html#Handling-R-objects-in-C

Especially check the section "Named objects and copying", which explains in
more detail how to control the standard R behaviour. Also keep in mind that
data frames are list-like structures, which are handled differently from
atomic vectors.

Hope this helps.
Kind regards
Joris

On Thu, Jan 9, 2020 at 12:48 PM lille stor <lille.stor using gmx.com> wrote:

> Hello,
>
> I would like for my C function to be able to manipulate some values stored
> in an R data frame.
>
> To achieve this, a need the (real) memory address where the R data frame
> stores its data (hopefully in a contiguous way). Then, from R, I call the C
> function and passing this memory address as a parameter.
>
> The question: how can we get the memory address of the R data frame?
>
> Thank you!
>
> L.
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)
<https://maps.google.com/?q=Coupure+links+653,%C2%A0B-9000+Gent,%C2%A0Belgium&entry=gmail&source=g>
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



More information about the R-devel mailing list