External pointers are a powerful tool supported by the C API of the Renvironment and language that is documented in theWritingR Extensions manual. But there is limited native support forexternal pointers on the R side. This package provides some basic toolsto verify, create, modify, and tag ‘externalptr’ objects
library(xptr)a<-new_xptr("0x11a888090")b<-new_xptr("0x11a888098")is_xptr(a)#> [1] TRUExptr_address(a)#> [1] "0x11a888090"xptr_clear(a)is_null_xptr(a)#> [1] TRUEset_xptr_address(a,xptr_address(b))xptr_address(a)# default 'pointer' variant#> [1] "0x11a888098">xptr_address(a,FALSE)# non-'pointer' variant[1]"4740120728">The package is on CRAN and can be installed via
>install.packages("xptr")Ther-univerepage has source and binary builds from the repository version whichmay differ from the CRAN version and shows how to install them. Lastly,one can always rely onremotes::install_github():
> remotes::install_github("eddelbuettel/xptr")Randy Lai created the R package and prepared versions 1.0 to 1.1.3between 2017 and 2020.
Dirk Eddelbuettel adopted the package in 2025.
MIT
Initially created: Thu Oct 9 08:43:55 AM CDT 2025
Last modified: Thu Oct 09 08:46:36 CDT 2025