rpy2

Could not install rpy2 correctly

陌路散爱 提交于 2020-01-05 21:31:54
问题 I try to install rpy2 on my computer with R 3.1.1 using the command: pip install rpy2 --user It output success, but when I try to test it using python -m rpy2.tests It give me the following error File "/mnt/work1/software/python/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/mnt/work1/software/python/2.7/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/mnt/work1/users/home2/stamaki/.local/lib/python2.7

Installing Rpy2 on Mac OSX with Anaconda Python 3.4 and R 3.1 installed via Macports

时间秒杀一切 提交于 2020-01-05 12:12:30
问题 pip install rpy2 yields the error: /usr/bin/clang -bundle -undefined dynamic_lookup -L/Users/jeff/anaconda3/lib -arch x86_64 build/temp.macosx-10.5-x86_64-3.4/./rpy/rinterface/_rinterface.o -L/Users/jeff/anaconda3/lib -L/opt/local/Library/Frameworks/R.framework/Resources/lib -lR -lRlapack -licui18n -lRblas -o build/lib.macosx-10.5-x86_64-3.4/rpy2/rinterface/_rinterface.so ld: library not found for -licui18n clang: error: linker command failed with exit code 1 (use -v to see invocation) error:

convert_to_r_dataframe module object has no attribute

风流意气都作罢 提交于 2020-01-05 08:15:28
问题 I am new to python and learning pandas. I want to convert a pandas data frame "datframe" to an R-style data frame (to use rpy2 later). To this end I have the following two lines in my code: import pandas.rpy.common as com r_dataframe = com.convert_to_r_dataframe(datframe) The first command goes through but then I get the following error : Traceback (most recent call last): File "", line 1, in r_dataframe = com.convert_to_r_dataframe(datframe) AttributeError: 'module' object has no attribute

Using both matplotlib and rpy2 with multi-buildpacks on Heroku

我只是一个虾纸丫 提交于 2020-01-04 15:25:46
问题 I'm trying to use a multi-buildpack setup on Heroku with these two buildpacks: https://github.com/virtualstaticvoid/heroku-buildpack-r.git https://github.com/dbrgn/heroku-buildpack-python-sklearn/ I am using rpy2 to call R from python. I detailed the full process I used to get the slug to compile here. It works fine for numpy, scipy, and scikit-learn with rpy2. However, I'm also trying to get matplotlib to work with this setup, and I'm getting an error. I used matplotlib==1.1.0, as suggested

Running R's aov() mixed effects model from Python using rpy2

淺唱寂寞╮ 提交于 2020-01-03 03:20:06
问题 First to see if rpy2 was working properly I ran a simple model (stats.lm): import pandas as pd from rpy2 import robjects as ro from rpy2.robjects import pandas2ri pandas2ri.activate() from rpy2.robjects.packages import importr stats = importr('stats') R = ro.r df = pd.DataFrame(data={'subject':['1','2','3','4','5','1','2','3','4','5'],'group':['1','1','1','2','2','1','1','1','2','2'],'session':['1','1','1','1','1','2','2','2','2','2'],'covar':['1', '2', '0', '2', '1', '1', '2', '0', '2', '1']

trouble with rpy2, rpart passing data correctly from python to r

时光怂恿深爱的人放手 提交于 2020-01-01 07:35:22
问题 I am trying to run rpart through RPY2 using Python 2.6.5 and R 10.0. I create a data frame in python and pass it along but I get an error stating: Error in function (x) : binary operation on non-conformable arrays Traceback (most recent call last): File "partitioningSANDBOX.py", line 86, in <module> model=r.rpart(**rpart_params) File "build/bdist.macosx-10.3-fat/egg/rpy2/robjects/functions.py", line 83, in __call__ File "build/bdist.macosx-10.3-fat/egg/rpy2/robjects/functions.py", line 35, in

rpy2 works in console, but cannot be imported by website ( with error “R_isMethodsDispatchOn”)

…衆ロ難τιáo~ 提交于 2019-12-25 14:22:50
问题 I developed a web tool using CGI, python and apache. The CGI file was written by python, and it calls R functions through rpy2. The web tool works well on my personal computer. Then we are trying to set it up on the server (System: CentOS release 5.7). Since the version of python and R were old on the server, we installed latest Python and R and also rpy2 on the server(Python version: 2.7.8, R version 3.1.1 (2014-07-10), rpy2 version: 2.4.3). But the web tool meet problems when it tries to

Convert R Matrix to Pandas Dataframe

独自空忆成欢 提交于 2019-12-25 04:19:33
问题 I'm trying to convert an R matrix to a pandas dataframe. I am using: import pandas.rpy.common as com df = com.convert_to_r_dataframe(r_matrix) And I get: TypeError: 'float' object cannot be interpreted as an index Strangely enough this use case is omitted from all documentation I have come across. I would also settle for a conversion of the R matrix to a numpy array - since I will want to iterate over the rows anyway. 回答1: Just use numpy.array() : from rpy2 import robjects m = robjects.reval(

“ValueError: codes need to be between -1 and len(categories)-1” when extracting null values in rpy2

点点圈 提交于 2019-12-25 00:22:20
问题 In using rpy2 with a built-in dataset from the synthpop R package ( SD2011 ), I get this error: robjects.r('head(SD2011)') # ... # ValueError: codes need to be between -1 and len(categories)-1 I drilled down the problem into a column which has null entries, e.g. I get the same error when doing this, but not adjacent rows or columns: robjects.r('SD2011[3, 27]') I confirmed this is a null value with: robjects.r('is.na(SD2011[, 27])') # array([0, 0, 1, ..., 0, 0, 0], dtype=int32) Why is rpy2 not

Python, R and rpy2 c-stack too close to the limit error message

自作多情 提交于 2019-12-24 19:02:41
问题 Edit: I have seen a few answers to this question for people working in UNIX based systems but I am working in windows so I don't think these will work. I am trying to call R from Python via the rpy2 package, everything seemed to be working fine and then one day I started to get his error, just trying to import rpy2 packages. The code is simply: from rpy2 import robjects as r from rpy2.robjects.packages import importr from rpy2.robjects.vectors import DataFrame from rpy2.robjects import