Python -> R bridge

rpy2 is an interface to R running embedded in a Python process.

1) a high-level interface making R functions and objects
just like Python functions and providing a seamless
conversion to numpy and pandas data structures

2) a low-level interface closer to the C-API

It is also providing features for when working with
jupyter notebooks or ipython.

Building the package - see also the rpy2.Slackbuild:
  Remove installed rpy2 before building and upgrading to a new 
  version.

  R needs to be compiled with the shared library flag, that is:
  build R on SBo with `R_SHLIB=yes` and `BLAS_SHLIB=yes`, now 
  the default for R at SBo.
   
  For linking to R, the path to installed R-libraries - e.g. 
  `/usr/lib64/R/lib` - has to be exported. This is done by 
  having this path in a `Rlibs.conf` file that is placed into 
  `/etc/ld.so.conf.d/` during installation of the package via a 
  `doinst.sh`. Because the $LIBDIRSUFFIX defines this path,
  the 'doinst.sh' is generated when running the rpy2.Slackbuild 
  and directly saved to the `package-rpy2/install` folder. A 
  `douninst.sh` removes this file when rpy2 is uninstalled via
  `removepkg`.

A utility module is included to check rpy2’s environment after 
installation:
  bash-5.3$ python -m rpy2.situation

Home:
  https://rpy2.github.io/
Documentation:
  https://rpy2.github.io/doc.html

Examples:
  https://rpy2.github.io/doc/latest/html/introduction.html#examples

Quick test (with example outcomes from 3.6.7):
  bash-5.3$ python3
  >>> import rpy2.robjects as robjects
  >>> r = robjects.r
  >>> rpy2.robjects.__version__
  # '3.6.5'
  >>> r("print('test')")
  # [1] "test"
  >>> r("print(version)")
  #               _                           
  # platform       x86_64-slackware-linux-gnu  
  # arch           x86_64                      
  # os             linux-gnu                   
  # system         x86_64, linux-gnu           
  # status                                     
  # major          4                           
  # minor          6.1                         
  # year           2026                        
  # month          06                          
  # day            24                          
  # svn rev        90187                       
  # language       R                           
  # version.string R version 4.6.1 (2026-06-24)
  # nickname       Happy Hop                   
  >>> r("library(stats)")
  >>> x = robjects.IntVector(range(10))
  >>> y = r.rnorm(10)
  >>> r.X11()
  # <rpy2.rinterface_lib.sexp.NULLType object at 0x7fce37927010> [0]
  # you see a frame "R Graphics Device # (ACTIVE)" popping up
  >>> r.layout(r.matrix(robjects.IntVector([1,2,3,2]), nrow=2, ncol=2))
  # <rpy2.robjects.vectors.IntVector object at 0x7fce3796d750> [13]
  # R classes: ('integer',)
  # [3]
  >>> r.plot(r.runif(10), y, xlab="runif", ylab="foo/bar", col="red")
  # <rpy2.rinterface_lib.sexp.NULLType object at 0x7fce37927010> [0]
  # you see a diagram
  >>> import rpy2.rinterface
  >>> rpy2.rinterface.__version__  # could be missing
  >>> import rpy2.situation
  >>> for row in rpy2.situation.iter_info():
  ...     print(row)
  ... 
