From pgilbert at bank-banque-canada.ca  Mon Apr 17 16:55:53 2006
From: pgilbert at bank-banque-canada.ca (Paul Gilbert)
Date: Mon, 17 Apr 2006 10:55:53 -0400
Subject: [Rd] slot named C
In-Reply-To: <Pine.LNX.4.64.0604171536450.5712@gannet.stats.ox.ac.uk>
References: <444395BC.5020108@bank-banque-canada.ca>
	<Pine.LNX.4.64.0604171446130.3487@gannet.stats.ox.ac.uk>
	<4443A656.4060306@bank-banque-canada.ca>
	<Pine.LNX.4.64.0604171536450.5712@gannet.stats.ox.ac.uk>
Message-ID: <4443AC79.9080801@bank-banque-canada.ca>



Prof Brian Ripley wrote:
> On Mon, 17 Apr 2006, Paul Gilbert wrote:
> 
>> Ok, but I'm surprised. I thought partial matching only happened for
>> named arguments. I guess I've been lucky.
> 
> Here C is named, so what did you mean?

Now I guess I've really been confused. I thought named arguments in a 
function were the optional ones you named when you define the function 
(with name=default, so Class is not a named argument in the call to 
new). Are you saying the named arguments are the ones you name when you 
call the function?

Paul
> 
> Partial matching happens for all arguments called by name, except for 
> those following ... in the formals.
> 
>>
>> Paul
>>
>> Prof Brian Ripley wrote:
>>> It's an error in your usage  The args of new() are
>>>
>>>> args(new)
>>> function (Class, ...)
>>>
>>> and what does 'C' match?  You need to name your arguments here.
>>>
>>> On Mon, 17 Apr 2006, Paul Gilbert wrote:
>>>
>>>> "C" appears to be an illegal name for a slot in an S4 class (example
>>>> below).
>>>
>>> It is rather an example of something which does not work.
>>>
>>> foo <- new("testobj")
>>> foo at C <- 2
>>>
>>> does, for example.
>>>
>>>> If this is a known limitation, and not a bug, it would be nice
>>>> if it were caught by setClass.
>>>>
>>>> Paul Gilbert
>>>>
>>>>> setClass("testobj", representation ( C = "numeric"))
>>>> [1] "testobj"
>>>>> new("testobj", C= 2)
>>>> Error in methodsPackageMetaName("C", name) :
>>>>        'The name of the object (e.g,. a class or generic function) to
>>>> find in the meta-data' must be a single string (got an object of class
>>>> "numeric")
>>>>
>>>>> setClass("testobj", representation ( C. = "numeric"))
>>>> [1] "testobj"
>>>>> new("testobj", C.= 2)
>>>> An object of class "testobj"
>>>> Slot "C.":
>>>> [1] 2
>>>> ==================================================================================== 
>>>>
>>>>
>>>>
>>>> La version fran?aise suit le texte anglais.
>>>>
>>>> ------------------------------------------------------------------------------------ 
>>>>
>>>>
>>>>
>>>> This email may contain privileged and/or confidential
>>>> inform...{{dropped}}
>>>>
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>
>>>>
>>>
>> ==================================================================================== 
>>
>>
>> La version fran?aise suit le texte anglais.
>>
>> ------------------------------------------------------------------------------------ 
>>
>>
>> This email may contain privileged and/or confidential 
>> inform...{{dropped}}
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
> 
====================================================================================

La version fran?aise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential inform...{{dropped}}



[Rd] slot named C
Paul Gilbert