Re: [R] Question about curve function

2011-06-07 Thread Matt Shotwell
On Tue, 2011-06-07 at 16:17 +0200, Uwe Ligges wrote: > > On 07.06.2011 11:57, peter dalgaard wrote: > > > > On Jun 6, 2011, at 11:22 , Prof Brian Ripley wrote: > > > >> As a further example of the trickiness, the "function" method of plot() > >> relies on curve(x, ...) being a request to plot the

Re: [R] Question about curve function

2011-06-07 Thread Uwe Ligges
On 07.06.2011 11:57, peter dalgaard wrote: On Jun 6, 2011, at 11:22 , Prof Brian Ripley wrote: As a further example of the trickiness, the "function" method of plot() relies on curve(x, ...) being a request to plot the function x(x) against x. I've added a comment to that effect to the he

Re: [R] Question about curve function

2011-06-07 Thread peter dalgaard
On Jun 6, 2011, at 11:22 , Prof Brian Ripley wrote: > As a further example of the trickiness, the "function" method of plot() > relies on curve(x, ...) being a request to plot the function x(x) against x. > I've added a comment to that effect to the help page. Ouch. This springs to mind: > f

Re: [R] Question about curve function

2011-06-06 Thread Prof Brian Ripley
As a further example of the trickiness, the "function" method of plot() relies on curve(x, ...) being a request to plot the function x(x) against x. I've added a comment to that effect to the help page. On Mon, 6 Jun 2011, Prof Brian Ripley wrote: On Sun, 5 Jun 2011, Abhilash Balakrishnan wr

Re: [R] Question about curve function

2011-06-05 Thread Prof Brian Ripley
On Sun, 5 Jun 2011, Abhilash Balakrishnan wrote: Dear Mr. Murdoch, I find out that still do not understand why the following does not work: curve(expression(x)) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ As here the input to curve is an expression, as docume

Re: [R] Question about curve function

2011-06-05 Thread Abhilash Balakrishnan
Dear Mr. Murdoch, I find out that still do not understand why the following does not work: > curve(expression(x)) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ As here the input to curve is an expression, as documented in the help, and the expression is simply x.

Re: [R] Question about curve function

2011-06-05 Thread Abhilash Balakrishnan
Dear Mr. Murdoch, I now understand that curve does not know how to guess what x in curve(x) means. As you say, it might guess that x means a function, and if there is a function x, execute it. This is seen in the example: > x <- function(x) { x } > curve(x) I think, if curve guesses I have a f

Re: [R] Question about curve function

2011-06-05 Thread Duncan Murdoch
On 11-06-05 1:07 PM, Abhilash Balakrishnan wrote: Dear Sirs, I am a new user of the R package. When I try to use the curve function it confuses me. curve(x^2) Works fine. curve(x) Makes a complaint I don't understand. Why is x^2 valid and x is not? curve() is a convenience function, an

Re: [R] Question about curve function

2011-06-05 Thread Matt Shotwell
I think there is trouble because expr in curve(expr) may be the name of a function, and it's ambiguous whether 'x' should be interpreted as a mathematical expression involving x, or the name of a function. Here are some examples that work: curve(I(x)) curve(1*x) On Sun, 2011-06-05 at 12:07 -0500,