On Wed, 30 Jul 2003, Damon Wischik wrote: > > Why does > > curve(function(y) y^2, from=0,to=1) > not work, whereas > > myf <- function(y) y^2 > > curve(myf, from=0,to=1) > work? >
Because someone was trying to be too clever in writing curve(). The first argument must either be an expression with the free variable `x' or the *name* of a function. You can't specify a literal function or the name of an expression. The reason is that it is hard to tell whether an argument is a function or an expression without evaluating it, and if it's an expression you may not be able to evaluate it. You could always use plot(function(y) y^2) -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help