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
1 answer

Using R in Python with Rpy2: how to ggplot2?

I am trying to use R in Python and I found Rpy2 very interesting. It is powerful and not that difficult to use, however even if I have read the documentation and looked for a similar question, I wasn't able to solve my problem with the ggplot2…
Revo
  • 87
  • 2
  • 10
5
votes
1 answer

Reading .RData files into python using rpy2

I am trying to read a .RData file into python using the rpy2 module. Below is the code >>> from rpy2.robjects import r >>> r.load("path to .rdata file") Traceback (most recent call last): File "", line 1, in File…
cyber_tooth
  • 133
  • 2
  • 9
5
votes
1 answer

use model.matrix through rpy2?

I prefer python over R for my work. From time to time, I need to use R functions, and I start to try Rpy2 for that purpose. I tried but failed to find out how to replicate following with Rpy2 design <- model.matrix(~Subject+Treat) I have gone as…
xyliu00
  • 726
  • 1
  • 9
  • 24
5
votes
1 answer

How to point rpy2 to existing R installation?

I have two installations of R. Is there a way to explicitly point rpy2 to one of these?
vdesai
  • 813
  • 1
  • 6
  • 15
5
votes
2 answers

Python Dictionary to R session

I have a python dictionary and want to import it in R. d = {'X1':[[1,2,3], [10,20]], 'X2':[4,5,6,7]} In "R" I want it as > d $X1 $X1[[1]] [1] 1 2 3 $X1[[2]] [1] 10 20 $X2 [1] 4 5 6 7 How can I export/save the python dictionary and read it in…
d.putto
  • 7,185
  • 11
  • 39
  • 45
5
votes
1 answer

Get a clean summary of nlme.lme() or lme4.lmer() in RPy

I am interfacing with the nlme and lme4 R functions via RPy, and I would like to get access to an output summary from my python console. I run the following code: test1=nlme.lme(r.formula('Pupil~CoI*Time'),…
TheChymera
  • 17,004
  • 14
  • 56
  • 86
5
votes
2 answers

Unable to install rpy2 on Mac OS X 10.9

I have been trying to install rpy2 on Mac OS X 10.9, but I have not been able to do so. I think there is a problem with the R shared library, but I read that R is installed with the shared library option as default. Any help would be very…
user3448087
5
votes
3 answers

Convert pandas.TimeSeries to R.ts

I have some pandas TimeSeries with date index: import pandas as pd import numpy as np pandas_ts = pd.TimeSeries(np.random.randn(100),pd.date_range(start='2000-01-01', periods=100)) I need convert it to R TS (like sunspots dataset) to call some R…
Andrey Shokhin
  • 11,250
  • 1
  • 16
  • 15
5
votes
1 answer

controlling z-order of points and combining legends from multiple layers in ggplot2/rpy2

I have a dense scatter plot where I want to control the order of the points being plotted, since using an alpha does not work - basically, there is a minority of points that I want to be plotted "on top". It sounds like the only way to control this…
user248237
5
votes
0 answers

Importing rpy2 modules in Enthought Canopy python

I reinstalled R and rpy2 after installing Enthought Canopy python. In python I can now: import rpy2 without an error message. However, when I want to import any specific rpy2 modules, I get the following error: import…
Martin
  • 93
  • 1
  • 4
5
votes
2 answers

using rpy2 with IPython notebooks?

Is it possible to use rpy2 (calling ggplot2) with IPython notebooks, and then save them (and share on NBViewer like other notebooks http://nbviewer.ipython.org/)? Is there any challenge in having the rpy2 ggplots appear in the notebook and/or…
user248237
5
votes
3 answers

creating multiple scatter plots with same axes in R

I'm trying to plot four scatter plots in 2 x 2 arrangement in R (I'm actually plotting via rpy2). I'd like each to have an aspect ratio of 1 but also be on the same scale, so identical X and Y ticks for all the subplots so that they can be compared.…
user248237
5
votes
4 answers

Installing rpy2 without admin privileges

I am having trouble installing the Python package rpy2. I have already compiled R as a shared library, but I do not have admin priviledges so I am trying to install rpy2 with: pip install -user rpy2 However, I am getting the following…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
5
votes
1 answer

RMagic, IPython and Summary Information

Following the example here http://www.randalolson.com/2013/01/14/filling-in-pythons-gaps-in-statistics-packages-with-rmagic/ I tried the same on a different data set found here, in an IPython…
BBSysDyn
  • 4,389
  • 8
  • 48
  • 63
5
votes
1 answer

Handing Null return in rpy2

I am using rpy2 to call R function from python. from rpy2.robjects import * result=r.someFunctioninR() #someFunctioninR is a R function written by myself if result==r('as.null()'): do something else: do something else The "result"…