Python package for using R in Python
Project description
RWrapR
Features 
RWrapR is a python package for using R inside of python.
It is built using rpy2, but attempts to be more convient to use.
Ideally you should never have to worry about using R objects,
instead treating R functions as normal python functions, where the inputs
and outputs are python objects.
import rwrapr as wr
import pandas as pd
import numpy as np
dplyr = wr.library("dplyr")
dt = wr.library("datasets")
dplyr.last(x=np.array([1, 2, 3, 4]))
dplyr.last(x=[1, 2, 3, 4])
iris = dt.iris
df = dplyr.mutate(iris, Sepal=wr.Lazily("round(Sepal.Length * 2, 0)"))
To do
1. Better warning handling (this will likely be tricky)
- Sometimes we will get datatypes which are incompatible,
e.g., warning accompanied by
2. Better handling of missing values.
Requirements
Rmust be installed
Installation
You can install RWrapR via pip from PyPI:
pip install rwrapr
Usage
Please see the Reference Guide for details.
Managing R dependencies
RWrapR will automatically install the required R packages, using the
global library path. Sometimes this is not desirable, and you may want to
use the renv package to manage your R dependencies. To do this, you can
use renv via the rwrapr package.
import rwrapr as wr
renv = wr.library("renv") # note you must install renv globally first
renv.init() # initialize renv
renv.install("statisticsnorway/ssb-metodebiblioteket")
renv.install("metodebiblioteket")
renv.snapshot(type="all") # update lock-file
If you are using .ipynb files, you can should add renv.autoload() to the
top of your notebook to ensure that the correct R environment is loaded.
For further details, see the Renv Article
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, RWrapR is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from Statistics Norway's SSB PyPI Template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rwrapr-0.9.1.tar.gz.
File metadata
- Download URL: rwrapr-0.9.1.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d1b9e8564e059a4f7ee3390854094ce2ca758a8cd6b8b47ce7e23e42f146978
|
|
| MD5 |
07a69d1868cab54ce864153823fe0546
|
|
| BLAKE2b-256 |
f3a4a1c659a3d3d76e85e7aec0355fcc1f8ee0774b5b854b5ff50a388054cf62
|
Provenance
The following attestation bundles were made for rwrapr-0.9.1.tar.gz:
Publisher:
release.yml on statisticsnorway/ssb-rwrapr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rwrapr-0.9.1.tar.gz -
Subject digest:
8d1b9e8564e059a4f7ee3390854094ce2ca758a8cd6b8b47ce7e23e42f146978 - Sigstore transparency entry: 189951488
- Sigstore integration time:
-
Permalink:
statisticsnorway/ssb-rwrapr@fa757caa702028b1e37c845623750f6b0770cfc0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/statisticsnorway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa757caa702028b1e37c845623750f6b0770cfc0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rwrapr-0.9.1-py3-none-any.whl.
File metadata
- Download URL: rwrapr-0.9.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f92ed5f52ace2cee25090bed7fd7978a4b59de48c803b337ac07a707d90a47e4
|
|
| MD5 |
a319b53df6787fb0979fc637094cf78e
|
|
| BLAKE2b-256 |
01eb0ee30c0d8a5dccbadb703136efe2d56ee9519585295b1600a945949f00fa
|
Provenance
The following attestation bundles were made for rwrapr-0.9.1-py3-none-any.whl:
Publisher:
release.yml on statisticsnorway/ssb-rwrapr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rwrapr-0.9.1-py3-none-any.whl -
Subject digest:
f92ed5f52ace2cee25090bed7fd7978a4b59de48c803b337ac07a707d90a47e4 - Sigstore transparency entry: 189951489
- Sigstore integration time:
-
Permalink:
statisticsnorway/ssb-rwrapr@fa757caa702028b1e37c845623750f6b0770cfc0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/statisticsnorway
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fa757caa702028b1e37c845623750f6b0770cfc0 -
Trigger Event:
push
-
Statement type: