Use
fun = r(" function(x) { x+1 }")
-G
----- Original Message -----
From: Antonio Garcia-Martinez <[EMAIL PROTECTED]>
To: rpy-list@lists.sourceforge.net <rpy-list@lists.sourceforge.net>
Sent: Thu Nov 20 23:35:25 2008
Subject: [Rpy] uniroot, and r.function()
I'm trying to use R's uniroot function from within python. The first arg is a
function, but I'm having trouble creating a function inside python using
r.function().
For example, a naive attempt:
>>> r.function( "x", "x+1" )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
rpy.RPy_RException: Error: invalid formal argument list for "function"
Passing but one arg returns (just as a wild attempt):
>>> r.function( "x" )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
rpy.RPy_RException: Error: incorrect number of arguments to "lambda"
The problem seems to be the R syntax of
f = func( x ) { ...}
doesn't seem to map well to the 'r.<R_function_name_here>' syntax of RPy.
Anyone have any idea what to do here?
Many thanks,
Antonio.
Research Scientist
Adchemy, Inc.
adchemy.com
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list