Hi rpy-ers,
I'm having a bit of a problem persuading rpy to forget a user defined function.
Suppose I write a python subroutine that defines and runs a R
function, something like:
def mysubroutine(data, string, condition)
set_default_mode(NO_CONVERSION)
if condition=="False":
r('filter <-
function(dat,string){index=which(attributes(dat)$forenames==string)\nreturn(index)}')
elif condition=="True":
r('filter <-
function(dat,string){index=which(attributes(dat)$surnames==string)\nreturn(index)}')
dataout = r.filter(rdata, string)
return(dataout)
If I now load the subroutine into ipython and run the subroutine,
using some appropriate data that is already an robj:
>>> x=mysubroutine(customers, "Joe", "False")
x is now an robj containing the R indexes of all customers whose
forename is Joe.
If I then run the subroutine again:
>>> y=mysubroutine(customers, "Blogs", "True")
y should be an robj containing the R indexes of all customers whose
surname is Blogs; but it isn't. It is an robj containing the R indexes
of all customers whose forename is Blogs. The user defined R-function
defined from the first run is not overwritten by the second run. Is
there any way to clear an R-function from rpys R instance?
--
Cheers,
Nick Schurch
Data Analysis Group (The Barton Group),
School of Life Sciences,
University of Dundee,
Dow St,
Dundee,
DD1 5EH,
Scotland,
UK
Tel: +44 1382 388707
Fax: +44 1382 345 893
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list