PythonInR
makes it easy to send R objects to Python, retrieve Python objects to R, call Python functions/methods and evaluate Python code. Furthermore, it allows to generate virtual Python objects in R and to import entire Python packages to R, by automatically generating the appropriate interfaces. A shortcoming of automatically generated interfaces is that they depend on the type transformations automatically done by PythonInR
. Since it is normally not possible to get a 1:1 mapping between the data structures of two programming languages, one has to decide how to deal with this ambiguity. The new version of PythonInR
deals with this challenge in two ways. Firstly, it allows the user to specify additional type information, so called typehints. From a technical point of view, typehints are just attributes, which allow to provide additional information in a structured way (e.g. $\verb+th.string(x)+$) without changing the class information and print behavior. Secondly, since Python, unlike R, has no built-in data structures for matrices and vectors, PythonInR
reimplements those data structures with the appropriate methods, so they can easily be transformed into their Python equivalents, if the necessary packages are available. Equipped with an 1:1 mapping of the most common types it is possible to programmatically generate bindings in a meaningful way. In the talk, I would like to present how to use PythonInR
and show how to import entire packages into R.