From Waclaw.Marcin.Kusnierczyk at idi.ntnu.no  Fri Mar 13 21:51:47 2009
From: Waclaw.Marcin.Kusnierczyk at idi.ntnu.no (Wacek Kusnierczyk)
Date: Fri, 13 Mar 2009 21:51:47 +0100
Subject: [Rd] surprising behaviour of names<-
In-Reply-To: <49BAB3C5.9010401@acm.org>
References: <49B67CB1.8060005@idi.ntnu.no>	<49B682F9.8050307@biostat.ku.dk>	<49B6E6D9.7010809@idi.ntnu.no>	<96A4BB14-D6EA-44B1-B524-6DB139F3A7F8@r-project.org>	<8CCAAAD3-919F-462F-A616-F4FDDB46D975@r-project.org>	<49B81186.4070107@idi.ntnu.no>	<20090312154008.56706f38@berwin-nus1>	<49B8D060.8090206@idi.ntnu.no>	<20090312173231.7a2929df@berwin-nus1>	<49B8DB8F.5030704@idi.ntnu.no>	<20090312213508.719afa73@berwin5>	<49B91A7E.50107@idi.ntnu.no>	<20090312231240.6a061f0b@berwin5>	<49B96FE7.2060705@idi.ntnu.no>	<20090313120309.7acb13e5@berwin-nus1>	<49BA38EB.3000004@idi.ntnu.no>
	<49BAB3C5.9010401@acm.org>
Message-ID: <49BAC763.5040104@idi.ntnu.no>

Tony Plate wrote:
> Wacek Kusnierczyk wrote:
>> [snip]
>> i just can't get it why the manual does not manifestly explain what
>> 'names<-' does, and leaves you doing the guesswork you suggest.
>>
>>   
> I'm having trouble understanding the point of this discussion. 
> Someone is calling a replacement function in a way that it's not meant
> to be used, and is them complaining about it not doing what he thinks
> it should, or about the documentation not describing what happens when
> one does that?

where is it written that the function is not meant to be used this way? 
you get an example in the man page, showing precisely how it could be
used that way.  it also explains the value of 'names<-':

"
 For 'names<-', the updated object.  (Note that the value of
     'names(x) <- value' is that of the assignment, 'value', not the
     return value from the left-hand side.)
"

it does speak of 'names<-' used in prefix form, and does not do it in
any negative (discouraging) way.

>
> Is there anything incorrect or missing in the help page for normal
> usage of the replacement function for 'names'? (i.e., when used in an
> expression like 'names(x) <- ...')

what is missing here in the first place is a specification of what
'normal' means.  as far as i can see from the man page, 'normal' does
not exclude prefix use.  and if so, what is missing in the help page is
a clear statement what an application of 'names<-' will do, in the sense
of what a user may observe.

>
> R does give one the ability to use its facilities in non-standard
> ways.  However, I don't see much value in the help page for 'gun'
> attempting to describe the ways in which the bones in your foot will
> be shattered should you choose to point the gun at your foot and pull
> the trigger.  Reminds me of the story of the guy in New York, who
> after injuring his back in refrigerator-carrying race, sued the
> manufacturer of the refrigerator for not having a warning label
> against that sort of use.

very funny.  little relevant.

vQ



[Rd] surprising behaviour of names<-
Wacek Kusnierczyk