Re: [R] Using substitute in nested function calls

2012-02-21 Thread Sebastian Kranz
Thanks, that is exactly what I have been looking for! On Tue, 21 Feb 2012 11:58:01 +0100 Eik Vettorazzi wrote: Hi Sebastian, how about this: mycurve <- function (expr) { do.call(curve,list(substitute(expr),-100,100)) } mycurve(x^2) mycurve(sin(x/20)) mycurve(x+x^2-x^3) cheers Am 21.02.2012

Re: [R] Using substitute in nested function calls

2012-02-21 Thread Eik Vettorazzi
Hi Sebastian, how about this: mycurve <- function (expr) { do.call(curve,list(substitute(expr),-100,100)) } mycurve(x^2) mycurve(sin(x/20)) mycurve(x+x^2-x^3) cheers Am 21.02.2012 06:28, schrieb Sebastian Kranz: > Dear List members, > > I really, like the feature that one can call R functions

[R] Using substitute in nested function calls

2012-02-20 Thread Sebastian Kranz
Dear List members, I really, like the feature that one can call R functions with mathematical expressions, e.g. curve(x^2, 0, 1) I wonder, how I can construct in a simple way a function like mycurve = function (expr) {...} such that that a call mycurve(x^2) has the same effect as the call