Hi Everyone,
I have just join this mailing group, so sorry about my mail, if it is not like
those ones you used to read. Beside this I am totally new user of rpy2, so I
might have very common questions as well. Naturally, before I join the group, I
have read many links & pages where I tried to find the answer to my problems.
Many of them were answered, but I still have a lot.
Recently, I received a task to find out
1. how we could use R (mainly the SpatialVx package) in our verification
Python library, which is used for handling (stat & plots) verification data,
2. how to handle the Python iris cubes with this system (how to plot or
make statistics, or use the SpatialVx package in it)
3. and I need to document inside our Python library (Documentation &
Examples, so in IPython notebook) that I found, in order for using by my
colleagues.
Immediately after starting the search, I found the rpy2 that I could find in
our environment as well, so, based on the net, I started to write some basic
rpy2 programs. In the very first day, I have bump into some problem, like I
cannot run
stats = importr('stats')
because it gives an error: "The symbol format_perc in the package "stats" is
conflicting with a Python object attribute".
I have found this problem in several places, but for me, it seemed, that the
remedy of this problem is to download the rpy2 or R or the Python, or all of
them again, or use a new version of them.
My problem, in my workplace, I cannot do any of these.
Now, I am going to write you what we have - so what I can use:
R: version 3.2.2
Python: version 2.7.6
Rpy2: version 2.4.2
Apart from some problem (like stats package), I could run a few basic stats and
plotting programs. I thought, I am going to start to document in parallel. To
tell the truth, I have never made any documentation and have never used the
IPYthon. When I started to put one of my correctly running programs into an
IPython notebook, the plotting parts did not do what I need to do. Looking at
several "rpy2&IPython" links, I could solve several problems of mine, but I
still have some.
E.g.: one of my 3d plot did not appear inside the notebook, but in a different
window, that I could not even delete:
**********
import iris
import numpy as np
%load_ext rpy2.ipython
cube = iris.load_cube(iris.sample_data_path(air_temp.pp))
x=np.arange(1,74,1)
y=np.arange(1,97,1)
z=cube.data
%%R
library(rgl)
library(gplots)
plot3dperscolFunc = function(x,y,z){
c=z
c = cut(c, breaks=85)
colsrich = rich.colors(85)[as.numeric(c)]
r3dDefaults$windowRect <- c(0,50, 800, 800)
persp3d(x, y, z, col=colsrich, size=2)
#rgl.snapshot("myplot.png")
}
%Rpush x y z
%R plot3dperscolFunc(x,y,z)
*****************
I thoungt, I can learn many things first in the rpy2 manuals, and mainly the
graphics (not in the IPyton aspects, but just the normal rpy2):
Like:
http://rpy2.readthedocs.io/en/version_2.8.x/graphics.html
I started to run everything line by line, but immediately, in making the first
plot, I have failed, so I cannot even run these examples. It can be because of
the fact that we have much older version, but I became very confused, what to
do, how to do, how to handle the rpy2, the IPython, which help should I read
and I should not...etc.
If anyone could give me some guideline what to do, how to handle my problems,
or give some general advices, I would appreciate it.
Kind regards,
Gabi
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list