There's no way of specifying versions in R's library() function, so I'm
assuming that if you successfully have both versions of the package installed
in R, they must have different names (I'm pretty sure installing a new version
of a package overwrites the previous version). If that's the case, using the
latest version of rpy2 (2.1.0-rc):
from rpy2.robjects.packages import importr
new_package = importr("new.package.name")
old_package = importr("old.package.name")
And then just access the functions using standard python library syntax:
old_package.old_function() or new_package.some_other_function()
If you've somehow managed to have two different versions of the same package
installed in R with the same name, you'll have to find a more clever solution.
Cheers,
Brandon
________________________________
From: zahra sheikhbahaee <sheikhbah...@gmail.com>
To: "RPy help, support and design discussion list"
<rpy-list@lists.sourceforge.net>
Sent: Wed, April 7, 2010 6:26:46 PM
Subject: [Rpy] export a package of R in python program
Hi,
I am using a package of R in my python code. I have to import two versions of
package in my program, because there is a function in one of them which does
not exist in the new version. The problem is that, afterward I want to use one
of the functions of new version but it looks for the function in old version
and ask the parameters of the other version which does not have the some
abilities of the new funcion. I wonder how I could export from the first
package and import in the new one in one program.
Zahra.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list