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

Installing python module "rpy2" after installing Enthought Canopy

Some of my python scripts use rpy2 as an interface to R, which worked perfectly with the previous Enthought EPD python. I recently installed Canopy Python from Enthought. Python now no longer finds the rpy2 module, and when I try to reinstall it, I…
Martin
  • 93
  • 1
  • 4
4
votes
2 answers

rpy2 and R debugging

After some trouble I successfully installed rpy2. My aim is to build models (gam; library mgcv of Simon Wood) and use the predict function by passing a pandas dataframe from python through rpy2 to a gam model and retrieve the prediction. The R…
user1708646
  • 111
  • 1
  • 6
4
votes
1 answer

Converting numpy array to rpy2 matrix (forecast package, xreg parameter)

I don't seem to be able to get the line fit = forecast.Arima(series, order=order, xreg=r_exog_train) to work. It does work without the xreg parameter so I'm pretty sure it's the numpy array to rpy2 matrix conversion that makes a problem. Does…
Tim
  • 333
  • 4
  • 13
4
votes
1 answer

Error trying to use a R library with rpy2

I'm trying to use the forecast package from R using rpy2. I couldn't find out how to convert a list into a timeseries in rpy2, so I figured a pandas time series would work as well. from rpy2.robjects.packages import importr from rpy2.robjects import…
user1709173
4
votes
4 answers

LD_LIBRARY_PATH precendence and trouble with compiling

I am trying to install some software on a Linux machine (python's rpy2 package, rpy2.robjects in particular, if it matters). I need the software to look for its shared libraries in my local space, not in the global spaces like /usr/lib64 whatever. …
bob.sacamento
  • 6,283
  • 10
  • 56
  • 115
4
votes
4 answers

Save 2d numpy array to R file format using rpy2

This is a beginner's question but how do you save a 2d numpy array to a file in (compressed) R format using rpy2? To be clear, I want to save it in rpy2 and then later read it in using R. I would like to avoid csv as the amount of data will be…
Simd
  • 19,447
  • 42
  • 136
  • 271
4
votes
1 answer

Creating an R data.frame in python with low level rpy2

I am using the rpy2 package to bring some R functionality to python. The functions I'm using in R need a data.frame object, and by using rlike.TaggedList and then robjects.DataFrame I am able to make this work. However I'm having performance…
itai
  • 1,566
  • 1
  • 12
  • 25
4
votes
2 answers

Building R (cran) + rpy2 on ubuntu -> libRblas.so not found

I am trying to build R (tried 2.14.2 and 2.15) and rpy2 (2.2.6, python 2.7.1) on ubuntu (11.04, natty narwhal), to deploy it to a custom directory (in the following called /home/me/lib/R), since I do not have root access, but need a newer version…
flinz
  • 347
  • 4
  • 12
3
votes
2 answers

Statistics Tests (Kolmogorov and T-test) with Python and Rpy2

I've runned some algorithms and wanted to make some statistics analysis with the results. I have two vectors with the averages of the error rate. With R, using the line below I would get…
Arthur Alvim
  • 1,044
  • 12
  • 23
3
votes
5 answers

Rpy2 & ggplot2: LookupError 'print.ggplot'

Unhindered by any pre-existing knowledge of R, Rpy2 and ggplot2 I would never the less like to create a scatterplot of a trivial table from Python. To set this up I've just installed: Ubuntu 11.10 64 bit R version 2.14.2 (from r-cran…
Tim
  • 19,793
  • 8
  • 70
  • 95
3
votes
1 answer

How to change column names of a dataframe using rpy2

I want to do the equivalent of this R code: m2 <- cbind(1,2) colnames(m2) <- c("x","Y") When I do import rpy2.robjects as R m2 = R.r['cbind'](1,2) R.r['colnames'](m2) = R.StrVector(['x','y']) I get this error: SyntaxError: can't assign to…
Niek de Klein
  • 8,524
  • 20
  • 72
  • 143
3
votes
1 answer

How can I get an index vector in rpy2, or if that doesn't exist, how can I select two columns?

I want to do the same thing as in the R example found here: http://www.r-tutor.com/r-introduction/data-frame/data-frame-column-slice. He makes use of the mtcars datase which looks like this: mpg cyl disp hp drat wt ... Mazda RX4 …
Niek de Klein
  • 8,524
  • 20
  • 72
  • 143
3
votes
1 answer

Use R package "seasonal" in Python via rpy2: How to convert input data into compatible form?

I want to use R package "seasonal" in Python. I am trying to use rpy2 Python package to do so. My code are as below, but I get an error. I am guessing I need to convert my input data "s" into an acceptable form for "seasonal". How do I do so? Thank…
123456
  • 393
  • 3
  • 12
3
votes
1 answer

When using rpy.robjects a message comes up "Unable to determine R home: [WinError 2] The system could not find the specified file"

I'm implementing a simple function in python with the rpy2 API. In VScode I manage to print a confidence interval, calculating Z-statistic calling the function created with the robjects as seen in the pic. But before the printed value I get the…
João
  • 51
  • 1
  • 3
3
votes
0 answers

Creating Dockerfile container containing R (tidyverse) and Python (rpy2 configured with R)

I would like to create a Dockerfile so that when a user specifies mode=validation, both R with tidyverse and Python with rpy2 (configured with R) and other Python dependencies are installed. I'm having trouble with creating this containerized…
Wilson
  • 253
  • 2
  • 9