python rpy2 setseed,rpy2: RPy2是一个非常简单、健壮的R语言的Python调用接口 - 木兰确实...

rpy2是一个Python到R语言的桥梁,允许在Python环境中无缝使用R的功能。要安装rpy2,可以使用pip。基本安装命令为`pip install rpy2`。如果需要运行单元测试或完整安装所有依赖项,可以使用额外的选项。对于非系统安装的R,可能需要设置环境变量。此外,提供了Docker镜像以便在隔离环境中使用rpy2。项目还支持pytest进行测试,并遵循GPLv2许可。
摘要由CSDN通过智能技术生成

8ba443f8406f6958ae2af956e75de96b.png Python -> R bridge

rpy2.svg?style=flat-square

badge.svg

badge.svg

The project's webpage is here: https://rpy2.github.io/

Installation

pip should work out of the box:

pip installrpy2

The package has optional depencies providing

specific functionalities not otherwise required to use the rest of rpy2.

For example, to be able to run the unit tests:

pip installrpy2[test]

To install all dependencies, use:

pip installrpy2[all]

The package is known to compile on Linux, MacOSX

(provided that developper tools are installed, and you are ready

figure out how by yourself). The situation is currently a little

more complicated on Windows. Check the issue tracker.

In case you find yourself with this source without any idea

of what it takes to compile anything on your platform, try first

python setup.py install

Non system-R installations

Whenever R is in not installed in a system location, the system might not

know where to find the R shared library.

If R is in the PATH, that is entering R on the command line successfully starts

an R terminal, but rpy2 does not work because of missing C libraries, try the following

before starting Python:

exportLD_LIBRARY_PATH="$(python -m rpy2.situation LD_LIBRARY_PATH)":${LD_LIBRARY_PATH}

Docker

To try rpy2 in an ipython console:

docker run --rm -p 8888:8888 rpy2/jupyter-ubuntu:master-20.04 ipython

To run a jupypter notebook on port 8888:

docker run --rm -p 8888:8888 rpy2/jupyter-ubuntu:master-20.04

More information about Docker images can be found in the

docker image repository.

Images with jupyter are can be used with

mybinder.

Documentation

Documentation is available either in the source tree (doc/),

or online.

Testing

rpy2 uses pytest, with the plugin pytest-cov for code coverage. To

test the package from the source tree, either to check and installation

on your system or before submitting a pull request, do:

pytest tests/

For code coverage, do:

pytest --cov=rpy2.rinterface_lib \

--cov=rpy2.rinterface \

--cov=rpy2.ipython \

--cov=rpy2.robject \

tests

For more options, such as how to run specify tests, please refer to the pytest

documentation.

License

RPy2 can be used under the terms of the GNU

General Public License Version 2 or later (see the file

gpl-2.0.txt). This is the very same license R itself is released under.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值