Questions tagged [rpy2]

RPy is a very simple, yet robust, Python interface to the R Programming Language. It can manage all kinds of R objects and can execute arbitrary R functions (including the graphic functions). All errors from the R language are converted to Python exceptions. Any module installed for the R system can be used from within Python

RPy is a very simple, yet robust, Python interface to the R Programming Language. It can manage all kinds of R objects and can execute arbitrary R functions (including the graphic functions). All errors from the R language are converted to Python exceptions. Any module installed for the R system can be used from within Python.

rpy2 is a redesign and rewrite of rpy. It is providing a low-level interface to R, a proposed high-level interface, including wrappers to graphical libraries, as well as R-like structures and functions.

https://rpy2.bitbucket.io

1203 questions
5
votes
2 answers

rpy2 3.2.0 on python 3.7 issues w/ importing robjects

python 3.7.3, rpy2 3.2.0, the following code: from rpy2 import robjects Traceback (most recent call last): File "", line 1, in File ".virtualenvs/flask3/lib/python3.7/site-packages/rpy2/robjects/__init__.py", line 14, in…
Wells
  • 10,415
  • 14
  • 55
  • 85
5
votes
3 answers

How to use the lambda argument of smooth.spline in RPy WITHOUT Python interprating it as lambda

I want to use the natural cubic smoothing splines smooth.spline from R in Python (like som many others want as well (Python natural smoothing splines, Is there a Python equivalent to the smooth.spline function in R, Python SciPy UnivariateSpline vs…
Jakob
  • 1,063
  • 9
  • 17
5
votes
2 answers

Cannot import rpy2.robjects after updating pandas "ValueError: The system "%s" is not supported."

I'm running miniconda on Windows 10. I had installed rpy2 and used it in the past with no problems. Recently I upgraded from pandas version 0.24.0 to 0.25.1. After finding that broke a custom package that I've been working on I decided to drowngrade…
James Draper
  • 5,110
  • 5
  • 40
  • 59
5
votes
1 answer

Share variables between R and Python in jupyternotebook

How to pass the R variable to Python? In jupyternotebook, I'm using %reload_ext rpy2.ipython to use R and Python in one note. I know how to pass python variable to R by using %%R -i xxx to pass a python variable xxx to R in the cell, but how to pass…
Kid
  • 413
  • 4
  • 11
5
votes
1 answer

is there a way to return names from R vectors, matrices, etc. in rpy2 >= 3.0.0

I'd like to get the names from named R vectors (or matrices, etc.) back into Python. In rpy2 < 3.0.0 this was possible, e.g., >>> stats.quantile(numpy.array([1,2,3,4])) R object with classes: ('numeric',) mapped to:
5
votes
3 answers

I want to use pandas2ri in JUPYTER but tzlocal issue?

Everytime I try to import the pandas2ri in jupyter, python interface: from rpy2.robjects import pandas2ri I get the following error: ModuleNotFoundError Traceback (most recent call last) in…
hsayya
  • 131
  • 1
  • 10
5
votes
1 answer

R, Python, rpy2: "Error: cannot allocate vector of size xxx Mb"

I work on Python 3.7 with R 3.5.1. When I call my function from the R script from Python it works in principle, however in the end it crashes with output: rpy2.rinterface.RRuntimeError: Error: cannot allocate vector of size 1006.0 Mb I have 16GB…
ODstuck
  • 189
  • 1
  • 7
5
votes
1 answer

Convert python list of lists into R list of vectors in rpy2

I have a list of lists in python like the following like the following: test = [[4, 2, 5, 3], [5, 2], [6, 3, 2, 5, 5]] I want to input this into dunn.test in R using rpy2. However, I am not sure how to convert this into a list of numeric vectors…
Jack Arnestad
  • 1,845
  • 13
  • 26
5
votes
2 answers

Adding an element (vector) to a list in rpy2

In R, I can add elements to a list easily: mylist = list() mylist[[1]] = c(1,2) mylist[[2]] = c(2,3) mylist[[length(mylist)+1]] = c(3,4) How do I do this in rpy2? I am using rpy2 2.1.9. I tried the following but it doesn't work import rpy2.robjects…
highBandWidth
  • 16,751
  • 20
  • 84
  • 131
5
votes
0 answers

OSError: [WinError 126] The specified module could not be found

Here, I tried to call R function from python code. import numpy as np import pandas as pd import rpy2.robjects as ro import rpy2.robjects.numpy2ri rpy2.robjects.numpy2ri.activate() time_series_data = pd.read_csv(daily_file_path, sep=",",…
user3104352
  • 1,100
  • 1
  • 16
  • 34
5
votes
0 answers

Calling R's mRMRe from python using rpy2 : Update

I am trying to use the R package mRMRe for feature selection within Python as except this feature selection part, all the other modules are in Python. utils = importr('utils') # -- Only once. utils.install_packages('mRMRe') # Now we begin by…
Shuvayan Das
  • 1,198
  • 3
  • 20
  • 40
5
votes
0 answers

How to convert a dataframe column to a factor using rpy2?

I have a Pandas DataFrame in Python that I am converting to an R data.frame using rpy2. Some example setup code is as follows: import pandas as pd import rpy2.robjects as robjects from rpy2.robjects import r, pandas2ri df = pd.DataFrame({ …
North Laine
  • 384
  • 2
  • 14
5
votes
3 answers

Why is Rpy2 not installing in my OSX Sierra terminal?

I have seen a number of different people post this problem (example: Tried to guess R's HOME but no R command in the PATH. OsX 10.6 and Installing rpy2 on Mac OSX 10.8.5), but I have yet to find a viable solution. I have ensured that I have…
Bob McBobson
  • 743
  • 1
  • 9
  • 29
5
votes
1 answer

rpy2: how to get the return values from calling a R function

I would like to use the following R script in Python: > library(bfast) > apple <- read.csv("/Users/nskalis/Downloads/R/apple.csv", sep = ";", header=TRUE) > data = apple # data$in_bps: is vector of double numbers > data.ts <- ts(data$in_bps,…
nskalis
  • 2,232
  • 8
  • 30
  • 49
5
votes
1 answer

Getting Segmentation fault Core dumped error while importing robjects from rpy2

Installed R and rpy2 manually Installation is successful but getting the above mentioned error. Please help me out? Outputs of some useful commands: >>> import rpy2 >>>…
Sahil Thakur
  • 51
  • 1
  • 4