[R] Puzzled over curve() syntax.
Rolf Turner
rolf at math.unb.ca
Thu Oct 27 15:50:26 CEST 2005
It's probably toadally elementary (and, like, duhhhhh) but
I can't figure out why the following doesn't work:
curve(function(x){qnorm(x,4,25)},from=0,to=1)
I get the error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' and 'y' lengths differ
But if I do
foo <- function(x){qnorm(x,4,25)}
curve(foo,from=0,to=1)
it goes like a train.
Also
plot(function(x){qnorm(x,4,25)},from=0,to=1)
works just fine.
I'm using
> version
_
platform sparc-sun-solaris2.9
arch sparc
os solaris2.9
system sparc, solaris2.9
status
major 2
minor 2.0
year 2005
month 10
day 06
svn rev 35749
language R
This is just idle curiousity I guess, but I would like to deepen my
understanding. There's probably something about the ``expression''
concept that I'm not grokking here ....
Thanks for any insight.
cheers,
Rolf Turner
rolf at math.unb.ca
More information about the R-help
mailing list