Re: [Rpy] Faster way to perform computation of a R function

2012-02-23 Thread Nathaniel Smith
As a general note, if you want to do R-like manipulation of data in Python, you should look into 'numpy'. It's very standard, and provides an array type that works like R vectors, plus functions like 'log' and 'sum' that apply to all elements quickly. rpy2 also has some code to make it easy to inte

Re: [Rpy] Faster way to perform computation of a R function

2012-02-23 Thread Bruno Santos
I am a bit confused now I am using rinterface and not robjects so how do I managed to do the same with the rinterface? If I try to multiply two IntSexpVectors I just get a combination of vectors as in python rather than an actual sum of the two as in R. 2012/2/23 Laurent Gautier > On 2012-02-

Re: [Rpy] Faster way to perform computation of a R function

2012-02-23 Thread Bruno Santos
Thank you Laurent for your quick reply. The if k[i] == 0 in R is implement as being + p * (x == 0) which will add p if k[i]==0 or zero if not. I was trying to came up with a closer implementation but I cannot do sums or multiplications between Robjects is that right? 2012/2/23 Laurent Gautier

[Rpy] Faster way to perform computation of a R function

2012-02-23 Thread Bruno Santos
Hello everyone' I am trying to port an R function to estimate some parameters to the rpy2 but the performance in python is appaling. So I was wondering if there is a best way of doing this. What I have at the moment is: R code finbinom <-function(pars,x) { p<-pars[1] mu <- pars[2] size <- pars[3]