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
8
votes
8 answers

Attempting to run RPY2 in Python and receiving error 0X7e

I'm attempting to run RPY2 to utilize the TTR package in R, and running python 3.8.3 and R 4.0.2. However, when attempting to run the code os.environ['R_HOME'] = "C:\\Program Files\\R\\R-4.0.2\\bin\\x64" from rpy2.robjects.packages import…
Frank Drin
  • 1,613
  • 2
  • 13
  • 18
8
votes
3 answers

Bizzarre issue trying to make Rpy2 2.1.9 work with R 2.12.1, using Python 2.6 under Windows xp - Rpy can't find the R.dll?

I've been having a real issue trying to make Rpy2 play nice with my R install. I first tried installing the rpy2 MSI package, and this didn't appear to work. When I ran the recommended tests, it was giving me an error saying that it couldn't find…
8
votes
2 answers

Rpy2: how to access the R list-type variable?

I can fit a model in Jupyter/Python using rpy2, however, the result returned is a list type value in R. For example # Cell #1, load rpy2 and re %load_ext rpy2.ipython %R require(ggplot2) %R require(movMF) # Cell #2, generate data from Python from…
ZK Zhao
  • 19,885
  • 47
  • 132
  • 206
8
votes
3 answers

Installing rpy2 for Python 3 using pip

I am trying to install the rpy2 package for python 3 on Windows 7. So I simply typed pip install rpy2 in the command line. However, it fails for a reason I do not understand, could anyone clear this up please? It threw back the following in the…
splinter
  • 3,727
  • 8
  • 37
  • 82
8
votes
1 answer

Rpy2 error wac-a-mole: R_USER not defined

I'm running Python (x,y) 2.7 on windows 7 32 bit and R version 3.1.0. I've been trying to install Rpy2 and have been getting many errors. I finally found this site which has pre-compiled python modules for windows…
Cascadian
  • 93
  • 1
  • 5
8
votes
3 answers

Getting error in installing rpy2 on windows

I am trying to install rpy2 package and getting following error both with C:\python27>easy_install rpy2 Searching for rpy2 Reading http://pypi.python.org/simple/rpy2/ Reading http://rpy.sourceforge.net Best match: rpy2 2.3.3 Downloading…
user2151600
  • 81
  • 1
  • 2
8
votes
3 answers

suppress warnings in rpy2

When I import R in python, using rpy2, how do I suppress warnings? It appears that in R you have to do just the following options(warn=-1) ...but I'm not familiar with R. How do I do this in python?
Ricky Robinson
  • 21,798
  • 42
  • 129
  • 185
7
votes
2 answers

Conversion 'py2rpy' not defined for objects of type ''

I am trying to run R in a google collab notebook (which worked fine before, however as I now tried to access it and run it it keeps giving me an error). I have ran the following: %load_ext rpy2.ipython %%R …
aperis
  • 79
  • 1
  • 4
7
votes
0 answers

rpy2: latest version doesn't work on Ubuntu

When I do from rpy2.robjects import r I get an error: >>> from rpy2.robjects import r Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/dist-packages/rpy2/robjects/__init__.py", line…
Parzival
  • 2,004
  • 4
  • 33
  • 47
7
votes
1 answer

What setup is need to compile rpy2 on Windows?

I've been able to install rpy2 v2.0.8 from the .msi from source forge, but I'd like to use the latest version that includes the packages code, i.e. v2.1.9. I'm attempting to compile rpy2 in windows (python 2.6.6). CL is complaining because…
DangerMouse
  • 704
  • 7
  • 20
7
votes
2 answers

How to run R script in python using rpy2

My question seems very basic but I don't find an answer even on rpy2 documentation. I have *.R script that accept one argument as "file.txt" (I need to pass the argument not from the command line). I want to call the R script inside a python script…
LearnToGrow
  • 1,656
  • 6
  • 30
  • 53
7
votes
1 answer

Clearing memory used by rpy2

How can I clear objects (and the memory they occupy) created via rpy? import rpy2.robjects as r a = r.r('a = matrix(NA, 2000000, 50)') del a #if I do this, there is no change in the amount of memory used r.r('rm(list=(ls(all=TRUE)))') # Same…
Benjamin
  • 11,560
  • 13
  • 70
  • 119
7
votes
1 answer

R_ext/eventloop.h: No such file error while installing rpy2 using pip

When I try install rpy2 on Windows 10 using pip install rpy2 I get the following error: .... .... .\rpy\rinterface\_rinterface.c(70): fatal error C1083: Cannot open include file: 'R_ext/eventloop.h': No such file or directory error: command…
user3288051
  • 574
  • 1
  • 11
  • 28
7
votes
1 answer

Implement R package TSdist from python

I'm trying to implement the R package TSdist from python jupyter notebook. import rpy2.robjects.numpy2ri from rpy2.robjects.packages import importr rpy2.robjects.numpy2ri.activate() R = rpy2.robjects.r ## load in package TSdist =…
7
votes
1 answer

Selecting a specific row from an rpy2 DataFrame

My data frame is survey data that I have got from a .csv file. One of the columns is age and I am looking to remove all respondents under 18 years of age. I'll then need to isolate age groups (18-24, 25-35, etc) into their own dataframes that I can…
forestfanjoe
  • 412
  • 4
  • 11