[R] Arguments to "personalised" plot()
(Ted Harding)
Ted.Harding at manchester.ac.uk
Mon Oct 8 01:10:48 CEST 2007
On 07-Oct-07 21:51:29, Rolf Turner wrote:
>
> On 8/10/2007, at 10:01 AM, Deepayan Sarkar wrote:
>>[...]
>> I'm not sure exactly which part you didn't expect. Given this
>> definition of plotb, I would expect
>>
>> plotb(x,cos(x))
>>
>> to expand to
>>
>> plot(x, pch="+", col="blue", cos(x))
>>
>> and as far as I can tell, these give identical results.
>> Is that what surprises you? Why?
>>
>> The other possibility is that you are surprised by the behavior of
>>
>> plot(x, pch="+", col="blue", cos(x))
>>
>> Remember that named arguments trump positional matching, and
>> consequently, this is equivalent to
>>
>> plot(x, cos(x), pch="+", col="blue")
>
> I think that this is the crucial issue. I'm guessing that what
> puzzled Ted (it is what certainly puzzled me) was ``how did
> plot() know that cos(x) was the y-value?''
Exactly!
> Your (very well expressed) explanation makes this clear.
Agreed!
> cheers,
>
> Rolf Turner
And Cheers!
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 08-Oct-07 Time: 00:10:45
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list