[Rd] Memory address of character datatype

lille stor lille.stor at gmx.com
Wed Nov 1 19:37:19 CET 2017


Hi,
 
To get the memory address of where the value of variable "x" (of datatype "numeric") is stored one does the following in R (in 32 bit):
 
      library(pryr)
      x <- 1024
      addr <- as.numeric(address(x)) + 24    # 24 is needed to jump the variable info and point to the data itself (i.e. 1024)
 
The question now is what is the value of the jump so that one can obtain the memory address of where the value of variable "x" (of datatype "character"):
 

      library(pryr)
      x <- "abc"
      addr <- as.numeric(address(x)) + ??    # what should be the value of the jump so that it points to the data of variable "x" (i.e. abc)?
 
Thank you in advance!



More information about the R-devel mailing list