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
11
votes
5 answers

install rpy2 on Windows7 64bit for Python 2.7

I am trying to build and install rpy2 Python Module. But got an error (see below). I have R installed in C:\Program Files\R\R-2.15.0\ and R.h is in C:\Program Files\R\R-2.15.0\include. How can I tell setup.py to find the R header in that…
user1345198
  • 111
  • 1
  • 3
10
votes
1 answer

Calculating EuropeanOptionImpliedVolatility in quantlib-python

I have R code that uses RQuantlib library. In order to run it from python I am using RPy2. I know python has its own bindings for quantlib (quantlib-python). I'd like to switch from R to python completely. Please let me know how I can run the…
AnalyticsBuilder
  • 4,111
  • 4
  • 24
  • 36
10
votes
2 answers

ERROR:root:Cell magic `%%R` not found

I have python 3 env installed rpy2 with conda install -c r rpy2=2.8.5 load the cell magic in jupyter notebook with %load_ext rmagic when I try to use R block in notebook, it gives me the error ERROR:root:Cell magic `%%R` not found.
Hello lad
  • 17,344
  • 46
  • 127
  • 200
10
votes
6 answers

Rpy2 not finding package

I'm using Rpy2 on windows 7 64 and having trouble loading a package: in R: using(mi) in python: from rpy2.robjects.packages import importr mi=importr('mi') --------------------------------------------------------------------------- RRuntimeError …
KGS
  • 277
  • 2
  • 4
  • 11
10
votes
8 answers

rpy2 import is not working

I get an error when I try to import rpy2. Here is the code and error. >>> import pandas.rpy.common Traceback (most recent call last): File "C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-packages\IPython\core\interactiveshell.py",…
uday
  • 6,453
  • 13
  • 56
  • 94
10
votes
5 answers

Tried to guess R's HOME but no R command in the PATH. OsX 10.6

I am trying to install rpy2 and I am facing a common issue. Unfortunately all the solution I have found are for win7 I have installed a Python 2.7 and R 2.15. then I write on the terminal easy_install rpy2 or, alternatively pip install rpy2 Same…
user2988577
  • 3,997
  • 7
  • 21
  • 21
10
votes
4 answers

rpy2: Convert FloatVector or Matrix back to a Python array or list?

I'm using rpy2 and I have this issue that's bugging me: I know how to convert a Python array or list to a FloatVector that R (thanks to rpy2) can handle within Python. Can the opposite can be done? For example, I have a FloatVector or Matrix that is…
Néstor
  • 585
  • 8
  • 20
9
votes
4 answers

Plotting a fancy diagonal correlation matrix with coefficients in upper triangle

I have the following synthetic dataframe, including numerical and categorical columns as well as the label column. I want to plot a diagonal correlation matrix and display correlation coefficients in the upper part as the following: expected…
Mario
  • 1,631
  • 2
  • 21
  • 51
9
votes
1 answer

Install and use RPy2 (using conda) so that it uses default R installation in /usr/lib/R R

I want to call functions from my R packages in Python using RPy2. I installed RPy2 using conda and realized it installed a fresh copy of R inside conda... I don't want that. I just want to have and use one R, the default one in /usr/lib/R. How to do…
Samo
  • 2,065
  • 20
  • 41
9
votes
1 answer

rpy2 doesn't work - requires libiconv.so.2

I have a relatively fresh installation of anaconda, in which I installed rpy2 using "conda install rpy2". However, when I try running it, I get this error, e.g.: > /[dir]/anaconda/bin/python -m 'rpy2.tests' Traceback (most recent call last): File…
R S
  • 11,359
  • 10
  • 43
  • 50
9
votes
1 answer

Jupyter + rpy2 outputs to command prompt instead of notebook cell

Issue description Whenever loading rpy2 in a Jupyter notebook, R code executed with a %%Rcell magic gets printed in the command prompt instead of the notebook cell. Plots show up properly in the notebook though. I also noticed that the %R inline…
jodoox
  • 821
  • 2
  • 7
  • 22
9
votes
1 answer

How to preserve Labels when SPSS file (.sav) imported into pandas via rpy?

I'm looking to work on a SPSS files (.sav) using pandas. In the absence of the SPSS program, here's what a typical file looks like when converted to .csv: On investigation into what the first two rows signify (I don't know SPSS), it seems that the…
Pyderman
  • 14,809
  • 13
  • 61
  • 106
9
votes
2 answers

*Efficiently* moving dataframes from Pandas to R with RPy (or other means)

I have a dataframe in Pandas, and I want to do some statistics on it using R functions. No problem! RPy makes it easy to send a dataframe from Pandas into R: import pandas as pd df = pd.DataFrame(index=range(100000),columns=range(100)) from rpy2…
jeffalstott
  • 2,643
  • 4
  • 28
  • 34
9
votes
3 answers

Python and Rpy2: Calling plot function with options that have "." in them

I'm just starting to learn how to use rpy2 with python. I'm able to make simple plots and such, but I've run into the problem that many options in R use ".". For example, here's an R call that works: barplot(t, col=heat.colors(2),…
Andy Hall
  • 93
  • 1
  • 3
9
votes
1 answer

Installing the R interpeter and R as a shared library uder the same tree

I am a bit confused about how to install R (via compilation) as a shared library. The instructions here (Rpy2) say that I should do the following: # make distclean ./configure --enable-R-shlib make make…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
1 2
3
80 81