[R] Puzzled over curve() syntax.

From: Rolf Turner <rolf_at_math.unb.ca>
Date: Thu 27 Oct 2005 - 23:50:26 EST


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@math.unb.ca

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Oct 28 04:33:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:50 EST