Since I discovered rpy2 and the possibility to use %R within my ipython notebook, my coding has become much easier. But I might have hit a wall.
I need to generate value from a stable distribution. I am using stabledist package from R.
I need to run the command:
Fx = pstable(seq(-2,4,0.1), alpha =alfa_x, beta = -1, gamma = scale_x, delta = delta_x, pm = 1, lower.tail = TRUE, log.p = FALSE, subdivisions = 1000)
when I define one of my cell as a R cell, and I run the command there:
%%R
Fx = pstable(.....
everything works great.
but I need to place this function within a python script. So far I have used many R packages, and the push/pull of data has worked perfectly, so it has the use of lines of R codes (with %R rmagic) within python scripts.
however with this one, if I call the same package and function within a python script, in the following way:
python code...
%Rpush alfa_x
%Rpush scale_x
%Rpush delta_x
%R Fx = pstable(seq(-2,4,0.1), alpha =alfa_x, beta = -1, gamma = scale_x, delta = delta_x, pm = 1, lower.tail = TRUE, log.p = FALSE, subdivisions = 1000)
I get the Usage error:
UsageError: unrecognized arguments:.....
I basically get some of the error reported in this old [thread][1]
Any suggestion?
(I did try to use %%R within my python code, but it doesn't change anything)
[1]https://bitbucket.org/rpy2/rpy2/issue/253/r-select-flights-year-day
One option is to to use the classic way :