From ezztucker @end|ng |rom gm@||@com  Thu Jan  9 13:03:39 2020
From: ezztucker @end|ng |rom gm@||@com (Ezra Tucker)
Date: Thu, 9 Jan 2020 07:03:39 -0500
Subject: [Rd] Get memory address of an R data frame
In-Reply-To: <trinity-a73adb6e-7025-4545-9108-870c1a66fbfa-1578570504114@3c-app-mailcom-bs15>
References: <trinity-a73adb6e-7025-4545-9108-870c1a66fbfa-1578570504114@3c-app-mailcom-bs15>
Message-ID: <CAP0QTermHXvc4acercTa-Nrxnx0y5RcqaZyt5=5-bwh90QBWvA@mail.gmail.com>

Hi Lille,

Is it possible you're looking for tracemem() or inspect() ?

> x <- data.frame(z = 1:10)> tracemem(x)[1] "<0x55aa743e0bc0>"

> x[1] <- 2Ltracemem[0x55aa743e0bc0 -> 0x55aa778f6ad0]:
tracemem[0x55aa778f6ad0 -> 0x55aa778f6868]: [<-.data.frame [<-
tracemem[0x55aa778f6868 -> 0x55aa778f5b48]: [<-.data.frame [<-

> .Internal(inspect(x)) @55aa743e0bc0 19 VECSXP g0c1
[OBJ,MARK,NAM(7),TR,ATT] (len=1, tl=0) @55aa7440d420 13 INTSXP g0c0
[MARK,NAM(7)] 1 : 10 (compact) ATTRIB: @55aa743f9ea0 02 LISTSXP g0c0 [MARK]
TAG: @55aa72ac98a0 01 SYMSXP g0c0 [MARK,NAM(7),LCK,gp=0x6000] "names" (has
value) @55aa743e0fb0 16 STRSXP g0c1 [MARK,NAM(7)] (len=1, tl=0)
@55aa72be1c70 09 CHARSXP g0c1 [MARK,gp=0x61] [ASCII] [cached] "z" TAG:
@55aa72ac9d70 01 SYMSXP g0c0 [MARK,NAM(7),LCK,gp=0x4000] "class" (has
value) @55aa73ca59b8 16 STRSXP g0c1 [MARK,NAM(7)] (len=1, tl=0)
@55aa72b562b8 09 CHARSXP g0c2 [MARK,gp=0x61,ATT] [ASCII] [cached]
"data.frame" TAG: @55aa72ac9670 01 SYMSXP g0c0 [MARK,NAM(7),LCK,gp=0x4000]
"row.names" (has value) @55aa743e1c98 13 INTSXP g0c1 [MARK,NAM(7)] (len=2,
tl=0) -2147483648,-10



On Thu, Jan 9, 2020 at 6:48 AM lille stor <lille.stor at 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



[Rd] Get memory address of an R data frame
Ezra Tucker