rpy2

rpy2 works good in PyCharm and doesn't work in .exe file

﹥>﹥吖頭↗ 提交于 2019-12-13 03:49:53
问题 I am making an app using rpy2 library in Python 3.6.1. Everything works great when I am running the script from PyCharm but in .exe file there is a problem. When I click on the button (I am using tkinter for GUI) I don't get any statistics calculated in rpy2 (and again, everything works in PyCharm). I used cx_freeze to convert to .exe file. Does anyone have the idea what is the problem ? Thanks 来源: https://stackoverflow.com/questions/45391537/rpy2-works-good-in-pycharm-and-doesnt-work-in-exe

R tbats Model Seasonal Customer Flag No Results

删除回忆录丶 提交于 2019-12-13 03:46:07
问题 I am following this blog to identify seasonal customers in my time series data: https://www.kristenkehrer.com/seasonality-code My code is shamelessly nearly identical to the blog, with some small tweaks, code is below. I am able to run the code entirely, for 2000 customers. A few hours later, 0 customers were flagged as seasonal in my results. Manually looking at customers data over time, I do believe I have many examples of seasonal customers that should have been picked up. Below is a

Installing rpy2 on Mac OSX 10.8.5

ε祈祈猫儿з 提交于 2019-12-13 00:43:32
问题 I'm trying to install rpy2 on Mac Mountain Lion (10.8.5) with pip: sudo pip install rpy2 and get the following error message: clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future error: command 'clang' failed with exit status 1 My python version is 2.7.2, R version is 3.2.1. In some posts I've read that I need to install Xcode and command line tools to

non-conformable arrays when passing numpy array to R via rpy2

早过忘川 提交于 2019-12-12 21:18:24
问题 I am trying to pass a numpy array to the GAMLSS package in R. import numpy as np import rpy2.robjects as robjects from rpy2.robjects import numpy2ri numpy2ri.activate() r = robjects.r r.library("gamlss") r.library("gamlss.mx") L = r['data.frame'](np.array(np.random.normal(size=1000), dtype=([('x', np.float), ('y', np.float), ('z', np.float)]))) r.gamlssMX(robjects.Formula('z~1'), data=L) Running this returns Error in y0 - f0 : non-conformable arrays Yet I can pass the data frame to the linear

Reference package in personal library from rpy2

此生再无相见时 提交于 2019-12-12 18:56:31
问题 I have just installed the MSwM package from CRAN into my personal library location via RStudio, and I am trying to call it from Python using rpy2. However, it is giving me this error: rpy2.rinterface.RRuntimeError: Error in loadNamespace(name) : there is no package called 'MSwM' I have tried referencing the standard package and they have no problems loading. Here is my code in Python: from rpy2.robjects import r from rpy2.robjects.packages import importr base=importr('base') utils=importr(

rpy2 : Korean characters are not working on rpy2

自作多情 提交于 2019-12-12 12:16:39
问题 python code: import rpy2.robjects as robjects rCommand='''gender <- c("남자", "남자", "남자", "여자", "여자", "여자", "여자", "여자") age <- c(23, 25, 27, 29, 31, 33, 35, 37) outdf <- data.frame(gender, age) ''' robjects.r(rCommand) resultDf_r=robjects.globalenv["outdf"] print type(resultDf_r) Korean characters makes the python.exe killed. In R command terminal, "rCommand" above works well. I couldn't find any solution. Any help would be appreciated. my env: window 7 x64, python 2.7.8 x64, rpy2 2.5.4, R 3.1

Unable to install rpy2 on Mac OS X 10.9

自古美人都是妖i 提交于 2019-12-12 12:07:22
问题 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 appreciated! This is the log: Downloading from URL https://pypi.python.org/packages/source/r/rpy2/rpy2-2.3.9.tar.gz#md5=86851a56f637e7b87709eb2b91dc5075 (from https://pypi.python.org/simple/rpy2/) Running setup.py (path:/private/tmp/pip_build_root/rpy2/setup

rpy2, R and Ubuntu 12.04 - Invalid substring -fopenmp

十年热恋 提交于 2019-12-12 09:50:33
问题 What's the reason for the error when installing rpy2 on Ubuntu 12.04? easy_install rpy2 Searching for rpy2 Reading http://pypi.python.org/simple/rpy2/ Best match: rpy2 2.3.9 Downloading https://pypi.python.org/packages/source/r/rpy2/rpy2-2.3.9.tar.gz#md5=86851a56f637e7b87709eb2b91dc5075 Processing rpy2-2.3.9.tar.gz Running rpy2-2.3.9/setup.py -q bdist_egg --dist-dir /tmp/easy_install-DFDRi5/rpy2-2.3.9/egg-dist-tmp-7nyGO8 "/usr/lib/R/bin/R" CMD config --ldflags Invalid substring -fopenmp in

Read R function output as columns

╄→尐↘猪︶ㄣ 提交于 2019-12-12 06:49:41
问题 I'm trying to come up with a way to solve this question I asked yesterday: rpy2 fails to import 'rgl' R package My goal is to check if certain packages are installed inside R from within python . Following the recommendation by Dirk Eddelbuettel given in a comment on his answer, I'm using the installed.packages() function from R to list all the available packages. This is what I've got so far: from rpy2.rinterface import RRuntimeError from rpy2.robjects.packages import importr utils = importr

Clear R memory using Rpy2

早过忘川 提交于 2019-12-12 04:46:28
问题 I have a bunch of R functions which I need to call through python. However, I reach memory errors when I try to allocate a large matrix. The same functions run fine on RStudio on the same computer. Here is a code chunk which crashes: #python: import rpy2.robjects as ro import gc gc.collect() ro.r.source("calibration_functions.R") result1 = ro.r.func1() #Does some calculations, works fine. result2 = ro.r.func2(result1) #Crashes at this step #R code: func2 <- function(result1){ preds_mat =