Skip to contents

Package

nat.python nat.python-package
nat.python: library-agnostic Python interoperability for R

Python environment provisioning

Set up and check a managed Python for use from R via reticulate.

simple_python()
Install a managed Python environment for R
check_reticulate()
Check that a working Python is available via reticulate

Module management

Check, load and introspect Python modules, installing on demand.

check_module()
Ensure a Python module is installed and importable
module_available()
Check whether a Python module is available
module_version() forget_module_version()
The installed version of a Python module
py_module_info()
Report on installed Python modules

pandas and data conversion

Convert pandas DataFrames to R, recovering 64-bit ids and datetimes.

pandas2df()
Convert a pandas DataFrame to an R data frame
null2na()
Replace NULL elements of a list with NA

64-bit id marshalling

Round-trip large integer ids between R (bit64) and Python without loss.

pyids2bit64()
Convert a numpy 64-bit integer array to R
rids2pyint()
Convert R ids to Python 64-bit integers
rids2raw()
Convert 64-bit integer ids to raw bytes
int64_overflows()
Detect character input that would overflow signed 64-bit integers

Datetime

ts2pydatetime()
Convert an R time to a Python datetime