Skip to main content

Mapping R API to Python

Project description

Interoperate R with Python

CircleCI Build status codecov pypi

Installation

# install released version
pip install -U rchitect

# or the development version
pip install -U git+https://github.com/randy3k/rchitect

Why reinvent the wheel?

You may be curious why I reinvented the wheel when there is rpy2?

The main reason is to drive radian. rpy2 was not suitable because it is missing some key features for running the R REPL. Speaking of compatibility, rchitect has been thoroughly tested on multiple platforms such as Windows, macOS and Linux and we also provide binary wheels for user convenience.

Getting started

from rchitect import *
a = reval("1:5")     # evaluate an R expression in the global environment
b = rcopy(a)         # convert any RObject returned by `reval` to its python type
c = robject(b)       # convert any python object to its R type
d = rcall("sum", c)  # call an R function. Python objects are converted to RObjects implicitly.

FAQ

If rchitect fails to open the R shared library, user should first try to expose the path to R to the PATH vaiable.

In Linux/macOS, you could also export the environment variable R_HOME. For example,

$ export R_HOME=/usr/local/lib/R
$ radian

Sometimes, you may also need to futher specify LD_LIBRARY_PATH if R fails to find some shared libraries,

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`R RHOME`/lib"

Please also make sure that R was installed with the R shared library libR.so or libR.dylib or libR.dll. On Linux, the flag --enable-R-shlib may be needed to install R from the source.

Wiki

reticulate conversions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rchitect-0.3.8.tar.gz (27.0 kB view hashes)

Uploaded Source

Built Distributions

rchitect-0.3.8-cp37-cp37m-win_amd64.whl (58.7 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

rchitect-0.3.8-cp37-cp37m-win32.whl (57.2 kB view hashes)

Uploaded CPython 3.7m Windows x86

rchitect-0.3.8-cp37-cp37m-manylinux1_x86_64.whl (120.7 kB view hashes)

Uploaded CPython 3.7m

rchitect-0.3.8-cp37-cp37m-manylinux1_i686.whl (116.2 kB view hashes)

Uploaded CPython 3.7m

rchitect-0.3.8-cp37-cp37m-macosx_10_6_intel.whl (123.2 kB view hashes)

Uploaded CPython 3.7m macOS 10.6+ intel

rchitect-0.3.8-cp36-cp36m-win_amd64.whl (58.7 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

rchitect-0.3.8-cp36-cp36m-win32.whl (57.2 kB view hashes)

Uploaded CPython 3.6m Windows x86

rchitect-0.3.8-cp36-cp36m-manylinux1_x86_64.whl (120.7 kB view hashes)

Uploaded CPython 3.6m

rchitect-0.3.8-cp36-cp36m-manylinux1_i686.whl (116.2 kB view hashes)

Uploaded CPython 3.6m

rchitect-0.3.8-cp36-cp36m-macosx_10_6_intel.whl (123.1 kB view hashes)

Uploaded CPython 3.6m macOS 10.6+ intel

rchitect-0.3.8-cp35-cp35m-win_amd64.whl (58.7 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

rchitect-0.3.8-cp35-cp35m-win32.whl (57.2 kB view hashes)

Uploaded CPython 3.5m Windows x86

rchitect-0.3.8-cp35-cp35m-manylinux1_x86_64.whl (120.6 kB view hashes)

Uploaded CPython 3.5m

rchitect-0.3.8-cp35-cp35m-manylinux1_i686.whl (116.2 kB view hashes)

Uploaded CPython 3.5m

rchitect-0.3.8-cp35-cp35m-macosx_10_6_intel.whl (123.1 kB view hashes)

Uploaded CPython 3.5m macOS 10.6+ intel

rchitect-0.3.8-cp34-cp34m-win_amd64.whl (55.2 kB view hashes)

Uploaded CPython 3.4m Windows x86-64

rchitect-0.3.8-cp34-cp34m-win32.whl (55.1 kB view hashes)

Uploaded CPython 3.4m Windows x86

rchitect-0.3.8-cp34-cp34m-manylinux1_x86_64.whl (120.7 kB view hashes)

Uploaded CPython 3.4m

rchitect-0.3.8-cp34-cp34m-manylinux1_i686.whl (116.2 kB view hashes)

Uploaded CPython 3.4m

rchitect-0.3.8-cp34-cp34m-macosx_10_6_intel.whl (123.2 kB view hashes)

Uploaded CPython 3.4m macOS 10.6+ intel

rchitect-0.3.8-cp27-cp27mu-manylinux1_x86_64.whl (124.0 kB view hashes)

Uploaded CPython 2.7mu

rchitect-0.3.8-cp27-cp27mu-manylinux1_i686.whl (119.3 kB view hashes)

Uploaded CPython 2.7mu

rchitect-0.3.8-cp27-cp27m-win_amd64.whl (55.3 kB view hashes)

Uploaded CPython 2.7m Windows x86-64

rchitect-0.3.8-cp27-cp27m-win32.whl (55.1 kB view hashes)

Uploaded CPython 2.7m Windows x86

rchitect-0.3.8-cp27-cp27m-manylinux1_x86_64.whl (124.0 kB view hashes)

Uploaded CPython 2.7m

rchitect-0.3.8-cp27-cp27m-manylinux1_i686.whl (119.3 kB view hashes)

Uploaded CPython 2.7m

rchitect-0.3.8-cp27-cp27m-macosx_10_6_intel.whl (123.0 kB view hashes)

Uploaded CPython 2.7m macOS 10.6+ intel

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page